mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-23 22:17:31 +00:00
b261e63233
* chore: Change entity and component logic to use bitstream references * merge
25 lines
664 B
C++
25 lines
664 B
C++
#include "LUPExhibitComponent.h"
|
|
#include "EntityManager.h"
|
|
|
|
void LUPExhibitComponent::Update(float deltaTime) {
|
|
m_UpdateTimer += deltaTime;
|
|
if (m_UpdateTimer > 20.0f) {
|
|
NextLUPExhibit();
|
|
m_UpdateTimer = 0.0f;
|
|
}
|
|
}
|
|
|
|
void LUPExhibitComponent::NextLUPExhibit() {
|
|
m_LUPExhibitIndex++;
|
|
m_DirtyLUPExhibit = true;
|
|
Game::entityManager->SerializeEntity(m_Parent);
|
|
}
|
|
|
|
void LUPExhibitComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) {
|
|
outBitStream.Write(m_DirtyLUPExhibit);
|
|
if (m_DirtyLUPExhibit) {
|
|
outBitStream.Write(m_LUPExhibits[m_LUPExhibitIndex % m_LUPExhibits.size()]);
|
|
if (!bIsInitialUpdate) m_DirtyLUPExhibit = false;
|
|
}
|
|
}
|