mirror of
https://github.com/UberGames/EF2GameSource.git
synced 2024-11-14 00:11:10 +00:00
reformatting
This commit is contained in:
parent
b855763ada
commit
d451122521
1 changed files with 147 additions and 157 deletions
|
@ -38,119 +38,109 @@ class GotoHelperNodeEX;
|
||||||
//
|
//
|
||||||
// Method of Use: Called From State Machine
|
// Method of Use: Called From State Machine
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
class GotoHelperNodeEX : public Behavior
|
class GotoHelperNodeEX : public Behavior {
|
||||||
{
|
public:
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
// States
|
// States
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
public:
|
typedef enum {
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
GOTO_HNODE_FIND_NODE,
|
GOTO_HNODE_FIND_NODE,
|
||||||
GOTO_HNODE_MOVE_TO_NODE,
|
GOTO_HNODE_MOVE_TO_NODE,
|
||||||
GOTO_HNODE_SUCCESS,
|
GOTO_HNODE_SUCCESS,
|
||||||
GOTO_HNODE_FAILED
|
GOTO_HNODE_FAILED
|
||||||
} GotoHelperNodeStates_t;
|
} GotoHelperNodeStates_t;
|
||||||
|
|
||||||
|
//-------------------------------------
|
||||||
|
// Public Interface
|
||||||
|
//-------------------------------------
|
||||||
|
CLASS_PROTOTYPE(GotoHelperNodeEX);
|
||||||
|
|
||||||
|
GotoHelperNodeEX();
|
||||||
|
~GotoHelperNodeEX();
|
||||||
|
|
||||||
|
void SetArgs(Event* ev);
|
||||||
|
void AnimDone(Event* ev);
|
||||||
|
|
||||||
|
void Begin(Actor& self);
|
||||||
|
BehaviorReturnCode_t Evaluate(Actor& self);
|
||||||
|
void End(Actor& self);
|
||||||
|
|
||||||
|
// Accessors
|
||||||
|
void SetNode(HelperNode* node);
|
||||||
|
void SetMovementAnim(const str& anim);
|
||||||
|
|
||||||
|
|
||||||
|
virtual void Archive(Archiver& arc);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//-------------------------------------
|
||||||
|
// Internal Functionality
|
||||||
|
//-------------------------------------
|
||||||
|
void transitionToState(GotoHelperNodeStates_t state);
|
||||||
|
void setInternalState(GotoHelperNodeStates_t state, const str& stateName);
|
||||||
|
void init(Actor& self);
|
||||||
|
void think();
|
||||||
|
|
||||||
|
void setupStateMoveToNode();
|
||||||
|
BehaviorReturnCode_t evaluateStateMoveToNode();
|
||||||
|
void failureStateFindNode(const str& failureReason);
|
||||||
|
|
||||||
|
void setupStateFindNode();
|
||||||
|
BehaviorReturnCode_t evaluateStateFindNode();
|
||||||
|
void failureStateMoveToNode(const str& failureReason);
|
||||||
|
|
||||||
|
private:
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
// Parameters
|
// Parameters
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
private:
|
|
||||||
str _nodeType;
|
str _nodeType;
|
||||||
str _movementAnim;
|
str _movementAnim;
|
||||||
HelperNodePtr _node;
|
HelperNodePtr _node;
|
||||||
float _maxDistance;
|
float _maxDistance;
|
||||||
|
|
||||||
//-------------------------------------
|
|
||||||
// Internal Functionality
|
|
||||||
//-------------------------------------
|
|
||||||
protected:
|
|
||||||
void transitionToState ( GotoHelperNodeStates_t state );
|
|
||||||
void setInternalState ( GotoHelperNodeStates_t state , const str &stateName );
|
|
||||||
void init ( Actor &self );
|
|
||||||
void think ();
|
|
||||||
|
|
||||||
|
|
||||||
void setupStateMoveToNode ();
|
|
||||||
BehaviorReturnCode_t evaluateStateMoveToNode ();
|
|
||||||
void failureStateFindNode ( const str& failureReason );
|
|
||||||
|
|
||||||
void setupStateFindNode ();
|
|
||||||
BehaviorReturnCode_t evaluateStateFindNode ();
|
|
||||||
void failureStateMoveToNode ( const str& failureReason );
|
|
||||||
|
|
||||||
//-------------------------------------
|
|
||||||
// Public Interface
|
|
||||||
//-------------------------------------
|
|
||||||
public:
|
|
||||||
CLASS_PROTOTYPE( GotoHelperNodeEX );
|
|
||||||
|
|
||||||
GotoHelperNodeEX();
|
|
||||||
~GotoHelperNodeEX();
|
|
||||||
|
|
||||||
void SetArgs ( Event *ev );
|
|
||||||
void AnimDone ( Event *ev );
|
|
||||||
|
|
||||||
void Begin ( Actor &self );
|
|
||||||
BehaviorReturnCode_t Evaluate ( Actor &self );
|
|
||||||
void End ( Actor &self );
|
|
||||||
|
|
||||||
// Accessors
|
|
||||||
void SetNode ( HelperNode *node );
|
|
||||||
void SetMovementAnim ( const str &anim );
|
|
||||||
|
|
||||||
|
|
||||||
virtual void Archive ( Archiver &arc );
|
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
// Components
|
// Components
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
private:
|
|
||||||
GotoPoint _gotoPoint;
|
GotoPoint _gotoPoint;
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
// Member Variables
|
// Member Variables
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
private:
|
|
||||||
GotoHelperNodeStates_t _state;
|
GotoHelperNodeStates_t _state;
|
||||||
|
|
||||||
static const float NODE_RADIUS;
|
static const float NODE_RADIUS;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void GotoHelperNodeEX::SetNode ( HelperNode *node )
|
inline void GotoHelperNodeEX::SetNode(HelperNode* node) {
|
||||||
{
|
assert(node);
|
||||||
assert ( node );
|
|
||||||
_node = node;
|
_node = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void GotoHelperNodeEX::SetMovementAnim ( const str &anim )
|
inline void GotoHelperNodeEX::SetMovementAnim(const str& anim) {
|
||||||
{
|
|
||||||
_movementAnim = anim;
|
_movementAnim = anim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void GotoHelperNodeEX::Archive( Archiver &arc )
|
inline void GotoHelperNodeEX::Archive(Archiver& arc) {
|
||||||
{
|
Behavior::Archive(arc);
|
||||||
Behavior::Archive ( arc );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Archive Parameters
|
// Archive Parameters
|
||||||
//
|
//
|
||||||
arc.ArchiveString( &_nodeType );
|
arc.ArchiveString(&_nodeType);
|
||||||
arc.ArchiveString( &_movementAnim );
|
arc.ArchiveString(&_movementAnim);
|
||||||
arc.ArchiveSafePointer( &_node );
|
arc.ArchiveSafePointer(&_node);
|
||||||
arc.ArchiveFloat ( &_maxDistance );
|
arc.ArchiveFloat(&_maxDistance);
|
||||||
//
|
//
|
||||||
// Archive Components
|
// Archive Components
|
||||||
//
|
//
|
||||||
arc.ArchiveObject ( &_gotoPoint );
|
arc.ArchiveObject(&_gotoPoint);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Archive Member Variables
|
// Archive Member Variables
|
||||||
//
|
//
|
||||||
ArchiveEnum ( _state, GotoHelperNodeStates_t );
|
ArchiveEnum(_state, GotoHelperNodeStates_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __GOTO_HELPER_NODE_EX___ */
|
#endif /* __GOTO_HELPER_NODE_EX___ */
|
||||||
|
|
Loading…
Reference in a new issue