Player forced movement component (#672)

* Split out Level progression component
from Character Component
This is to get to the Player forced movement Comp in a sane way

* move XML to component insted of abusing charComp

* use overrides
should probably make everything that calls that call it correctly

* fix linking issue

* Add proper Player Force movement component
Not used, yet
This commit is contained in:
Aaron Kimbrell
2022-07-24 13:25:10 -05:00
committed by GitHub
parent f2d1c5d26d
commit b57cacc676
5 changed files with 147 additions and 54 deletions

View File

@@ -17,6 +17,7 @@ set(DGAME_DCOMPONENTS_SOURCES "BaseCombatAIComponent.cpp"
"MovingPlatformComponent.cpp"
"PetComponent.cpp"
"PhantomPhysicsComponent.cpp"
"PlayerForcedMovementComponent.cpp"
"PossessableComponent.cpp"
"PossessorComponent.cpp"
"PropertyComponent.cpp"

View File

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

View File

@@ -0,0 +1,70 @@
#pragma once
#include "Entity.h"
#include "GameMessages.h"
#include "Component.h"
/**
* Component that handles player forced movement
*
*/
class PlayerForcedMovementComponent : public Component {
public:
static const uint32_t ComponentType = eReplicaComponentType::COMPONENT_TYPE_PLAYER_FORCED_MOVEMENT;
/**
* Constructor for this component
* @param parent parent that contains this component
*/
PlayerForcedMovementComponent(Entity* parent);
~PlayerForcedMovementComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
/**
* @brief Set the Player On Rail object
*
* @param value if the player is on a rail
*/
void SetPlayerOnRail(bool value){ m_PlayerOnRail = value; m_DirtyInfo = true; }
/**
* @brief Set the Show Billboard object
*
* @param value if the billboard should be shown
*/
void SetShowBillboard(bool value){ 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 GetShowBillboard(){ return m_ShowBillboard; }
private:
/**
* whether the info is dirty
*/
bool m_DirtyInfo = false;
/**
* whether the player is on a rail
*/
bool m_PlayerOnRail = false;
/**
* whether the billboard should be showing
*/
bool m_ShowBillboard = false;
};