![]() |
Plasma Engine
2.0
|
A state machine state that sets the enabled flag on a game object and disables all other objects in the same group. More...
#include <StateMachineComponent.h>
Public Member Functions | |
plStateMachineState_SwitchObject (plStringView sName=plStringView()) | |
virtual void | OnEnter (plStateMachineInstance &ref_instance, void *pInstanceData, const plStateMachineState *pFromState) const override |
virtual plResult | Serialize (plStreamWriter &inout_stream) const override |
virtual plResult | Deserialize (plStreamReader &inout_stream) override |
![]() | |
plStateMachineState (plStringView sName=plStringView()) | |
void | SetName (plStringView sName) |
plStringView | GetName () const |
const plHashedString & | GetNameHashed () const |
virtual void | OnExit (plStateMachineInstance &ref_instance, void *pInstanceData, const plStateMachineState *pToState) const |
virtual void | Update (plStateMachineInstance &ref_instance, void *pInstanceData, plTime deltaTime) const |
virtual bool | GetInstanceDataDesc (plInstanceDataDesc &out_desc) |
Returns whether this state needs additional instance data and if so fills the out_desc. | |
![]() | |
virtual const plRTTI * | GetDynamicRTTI () const |
bool | IsInstanceOf (const plRTTI *pType) const |
Returns whether the type of this instance is of the given type or derived from it. | |
template<typename T > | |
PL_ALWAYS_INLINE bool | IsInstanceOf () const |
Returns whether the type of this instance is of the given type or derived from it. | |
Public Attributes | |
plString | m_sGroupPath |
plString | m_sObjectToEnable |
bool | m_bDeactivateOthers = true |
Additional Inherited Members | |
![]() | |
static const plRTTI * | GetStaticRTTI () |
A state machine state that sets the enabled flag on a game object and disables all other objects in the same group.
This state allows to easily switch the representation of a game object. For instance you may have two objects states: normal and burning You can basically just build two objects, one in the normal state, and one with all the effects needed for the fire. Then you group both objects under a shared parent (e.g. with name 'visuals'), give both of them a name ('normal', 'burning') and disable one of them.
When the state machine transitions from the normal state to the burning state, you can then use this type of state to say that from the 'visuals' group you want to activate the 'burning' object and deactivate all other objects in the same group.
Because the state activates one object and deactivates all others, you can have many different visuals and switch between them. You can also only activate an object and keep the rest in the group as they are (e.g. to enable more and more effects). If you only give a group path, but no object name, you can also use it to just disable all objects in a group. If multiple objects in the same group have the same name, they will all get activated simultaneously.
Make sure that essential other objects (like the physics representation or other scripts) are located on other objects, that don't get deactivated.
|
overridevirtual |
Reimplemented from plStateMachineState.
|
overridevirtual |
Implements plStateMachineState.
|
overridevirtual |
Reimplemented from plStateMachineState.