PlayerForcedMovementComponent pass

This commit is contained in:
David Markowitz 2023-07-09 22:20:51 -07:00
parent 28637a206d
commit 598d88b307
2 changed files with 13 additions and 23 deletions

View File

@ -1,16 +1,12 @@
#include "PlayerForcedMovementComponent.h" #include "PlayerForcedMovementComponent.h"
PlayerForcedMovementComponent::PlayerForcedMovementComponent(Entity* parent) : Component(parent) { #include "BitStream.h"
m_ParentEntity = parent;
}
PlayerForcedMovementComponent::~PlayerForcedMovementComponent() {}
void PlayerForcedMovementComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) { void PlayerForcedMovementComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
outBitStream->Write(m_DirtyInfo || bIsInitialUpdate); outBitStream->Write(m_DirtyInfo || bIsInitialUpdate);
if (m_DirtyInfo || bIsInitialUpdate) { if (m_DirtyInfo || bIsInitialUpdate) {
outBitStream->Write(m_PlayerOnRail); outBitStream->Write(m_PlayerOnRail);
outBitStream->Write(m_ShowBillboard); outBitStream->Write(m_ShowBillboard);
if (!bIsInitialUpdate) m_DirtyInfo = false;
} }
m_DirtyInfo = false;
} }

View File

@ -16,8 +16,7 @@ public:
* Constructor for this component * Constructor for this component
* @param parent parent that contains this component * @param parent parent that contains this component
*/ */
PlayerForcedMovementComponent(Entity* parent); PlayerForcedMovementComponent(Entity* parent) : Component(parent) {};
~PlayerForcedMovementComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags); void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
@ -26,28 +25,23 @@ public:
* *
* @param value if the player is on a rail * @param value if the player is on a rail
*/ */
void SetPlayerOnRail(bool value) { m_PlayerOnRail = value; m_DirtyInfo = true; } void SetPlayerOnRail(bool value) {
if (m_PlayerOnRail == value) return;
m_PlayerOnRail = value;
m_DirtyInfo = true;
}
/** /**
* @brief Set the Show Billboard object * @brief Set the Show Billboard object
* *
* @param value if the billboard should be shown * @param value if the billboard should be shown
*/ */
void SetShowBillboard(bool value) { m_ShowBillboard = value; m_DirtyInfo = true; } void SetShowBillboard(bool value) {
if (m_ShowBillboard == value) return;
m_ShowBillboard = value;
m_DirtyInfo = true;
}
/**
* @brief Get the Player On Rail object
*
* @return true
* @return false
*/
/**
* @brief Get the Player On Rail object
*
* @return true
* @return false
*/
bool GetPlayerOnRail() { return m_PlayerOnRail; } bool GetPlayerOnRail() { return m_PlayerOnRail; }
bool GetShowBillboard() { return m_ShowBillboard; } bool GetShowBillboard() { return m_ShowBillboard; }