mirror of
https://github.com/UberGames/EF2GameSource.git
synced 2025-02-18 17:41:19 +00:00
Formated closInOnEnemy
This commit is contained in:
parent
943ccac80f
commit
43147bda8b
1 changed files with 135 additions and 144 deletions
|
@ -37,108 +37,99 @@ class CloseInOnEnemy;
|
|||
//
|
||||
// Method of Use: Called From State Machine
|
||||
//--------------------------------------------------------------
|
||||
class CloseInOnEnemy : public Behavior
|
||||
{
|
||||
class CloseInOnEnemy : public Behavior {
|
||||
public:
|
||||
//------------------------------------
|
||||
// States
|
||||
//------------------------------------
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
CLOSE_IN_ON_ENEMY_APPROACH,
|
||||
CLOSE_IN_ON_ENEMY_SUCCESS,
|
||||
CLOSE_IN_ON_ENEMY_FAILED
|
||||
} closeInOnEnemyStates_t;
|
||||
|
||||
//------------------------------------
|
||||
// Parameters
|
||||
//------------------------------------
|
||||
private: // Parameters
|
||||
str _anim;
|
||||
str _torsoAnim;
|
||||
float _dist;
|
||||
//-------------------------------------
|
||||
// Public Interface
|
||||
//-------------------------------------
|
||||
CLASS_PROTOTYPE(CloseInOnEnemy);
|
||||
|
||||
CloseInOnEnemy();
|
||||
~CloseInOnEnemy();
|
||||
|
||||
void SetArgs(Event* ev);
|
||||
void Begin(Actor& self);
|
||||
BehaviorReturnCode_t Evaluate(Actor& self);
|
||||
void End(Actor& self);
|
||||
virtual void Archive(Archiver& arc);
|
||||
|
||||
void setAnim(const str& animName);
|
||||
void setTorsoAnim(const str& animName);
|
||||
void setDist(float distance);
|
||||
|
||||
//-------------------------------------
|
||||
// Internal Functionality
|
||||
//-------------------------------------
|
||||
protected:
|
||||
void transitionToState ( closeInOnEnemyStates_t state );
|
||||
void setInternalState ( closeInOnEnemyStates_t state , const str &stateName );
|
||||
void init ( Actor &self );
|
||||
void think ();
|
||||
void updateEnemy ();
|
||||
void setTorsoAnim ();
|
||||
void transitionToState(closeInOnEnemyStates_t state);
|
||||
void setInternalState(closeInOnEnemyStates_t state, const str& stateName);
|
||||
void init(Actor& self);
|
||||
void think();
|
||||
void updateEnemy();
|
||||
void setTorsoAnim();
|
||||
|
||||
void setupStateApproach ();
|
||||
BehaviorReturnCode_t evaluateStateApproach ();
|
||||
void failureStateApproach ( const str& failureReason );
|
||||
void setupStateApproach();
|
||||
BehaviorReturnCode_t evaluateStateApproach();
|
||||
void failureStateApproach(const str& failureReason);
|
||||
|
||||
//-------------------------------------
|
||||
// Public Interface
|
||||
//-------------------------------------
|
||||
public:
|
||||
CLASS_PROTOTYPE( CloseInOnEnemy );
|
||||
|
||||
CloseInOnEnemy();
|
||||
~CloseInOnEnemy();
|
||||
|
||||
void SetArgs ( Event *ev );
|
||||
void Begin ( Actor &self );
|
||||
BehaviorReturnCode_t Evaluate ( Actor &self );
|
||||
void End ( Actor &self );
|
||||
virtual void Archive ( Archiver &arc );
|
||||
|
||||
void setAnim ( const str &animName );
|
||||
void setTorsoAnim( const str &animName );
|
||||
void setDist ( float distance );
|
||||
private:
|
||||
//------------------------------------
|
||||
// Parameters
|
||||
//------------------------------------
|
||||
str _anim;
|
||||
str _torsoAnim;
|
||||
float _dist;
|
||||
|
||||
//-------------------------------------
|
||||
// Components
|
||||
//-------------------------------------
|
||||
private:
|
||||
GotoEntity _chaseEnemy;
|
||||
|
||||
//-------------------------------------
|
||||
// Member Variables
|
||||
//-------------------------------------
|
||||
private:
|
||||
closeInOnEnemyStates_t _state;
|
||||
EntityPtr _currentEnemy;
|
||||
Actor *_self;
|
||||
Actor* _self;
|
||||
|
||||
};
|
||||
|
||||
inline void CloseInOnEnemy::setAnim( const str &animName )
|
||||
{
|
||||
inline void CloseInOnEnemy::setAnim(const str& animName) {
|
||||
_anim = animName;
|
||||
}
|
||||
|
||||
inline void CloseInOnEnemy::setTorsoAnim( const str &animName )
|
||||
{
|
||||
inline void CloseInOnEnemy::setTorsoAnim(const str& animName) {
|
||||
_torsoAnim = animName;
|
||||
}
|
||||
|
||||
inline void CloseInOnEnemy::setDist( float distance )
|
||||
{
|
||||
inline void CloseInOnEnemy::setDist(float distance) {
|
||||
_dist = distance;
|
||||
}
|
||||
|
||||
inline void CloseInOnEnemy::Archive( Archiver &arc )
|
||||
{
|
||||
Behavior::Archive( arc );
|
||||
inline void CloseInOnEnemy::Archive(Archiver& arc) {
|
||||
Behavior::Archive(arc);
|
||||
|
||||
// Archive Parameters
|
||||
arc.ArchiveString ( &_anim );
|
||||
arc.ArchiveString ( &_torsoAnim );
|
||||
arc.ArchiveFloat ( &_dist );
|
||||
arc.ArchiveString(&_anim);
|
||||
arc.ArchiveString(&_torsoAnim);
|
||||
arc.ArchiveFloat(&_dist);
|
||||
|
||||
// Archive Components
|
||||
arc.ArchiveObject ( &_chaseEnemy );
|
||||
arc.ArchiveObject(&_chaseEnemy);
|
||||
|
||||
// Archive Member Variables
|
||||
ArchiveEnum ( _state, closeInOnEnemyStates_t);
|
||||
arc.ArchiveSafePointer ( &_currentEnemy );
|
||||
arc.ArchiveObjectPointer ( ( Class ** )&_self );
|
||||
ArchiveEnum(_state, closeInOnEnemyStates_t);
|
||||
arc.ArchiveSafePointer(&_currentEnemy);
|
||||
arc.ArchiveObjectPointer((Class **)&_self);
|
||||
}
|
||||
|
||||
#endif /* CLOSE_IN_ON_ENEMY_HPP */
|
||||
|
|
Loading…
Reference in a new issue