2021-12-05 17:54:36 +00:00
|
|
|
#include "LUPExhibitComponent.h"
|
|
|
|
|
|
|
|
#include "EntityManager.h"
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
LUPExhibitComponent::LUPExhibitComponent(Entity* parent) : Component(parent) {
|
|
|
|
m_Exhibits = { 11121, 11295, 11423, 11979 };
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
m_ExhibitIndex = 0;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
m_Exhibit = m_Exhibits[m_ExhibitIndex];
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
LUPExhibitComponent::~LUPExhibitComponent() {
|
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void LUPExhibitComponent::Update(float deltaTime) {
|
|
|
|
m_UpdateTimer += deltaTime;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
if (m_UpdateTimer > 20.0f) {
|
|
|
|
NextExhibit();
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
m_UpdateTimer = 0.0f;
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void LUPExhibitComponent::NextExhibit() {
|
|
|
|
m_ExhibitIndex++;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
if (m_ExhibitIndex >= m_Exhibits.size()) {
|
|
|
|
m_ExhibitIndex = 0;
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
m_Exhibit = m_Exhibits[m_ExhibitIndex];
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-06-09 09:46:01 +00:00
|
|
|
EntityManager::Instance()->SerializeEntity(m_ParentEntity);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void LUPExhibitComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, uint32_t& flags) {
|
|
|
|
outBitStream->Write1(); // Dirty flag?
|
|
|
|
outBitStream->Write(m_Exhibit);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|