This commit is contained in:
Walter Julius Hennecke 2014-03-09 22:47:15 +01:00
parent b9f90d4305
commit 4c152b09d0

View file

@ -40,14 +40,12 @@ class SnipeEnemy;
// //
// Method of Use: Called From State Machine // Method of Use: Called From State Machine
//-------------------------------------------------------------- //--------------------------------------------------------------
class SnipeEnemy : public Behavior class SnipeEnemy : public Behavior {
{ public:
//------------------------------------ //------------------------------------
// States // States
//------------------------------------ //------------------------------------
public: typedef enum {
typedef enum
{
SNIPE_AIM_AND_FIRE_AIM, SNIPE_AIM_AND_FIRE_AIM,
SNIPE_AIM_AND_FIRE_PRE_FIRE, SNIPE_AIM_AND_FIRE_PRE_FIRE,
SNIPE_AIM_AND_FIRE_ATTACK, SNIPE_AIM_AND_FIRE_ATTACK,
@ -56,22 +54,28 @@ class SnipeEnemy : public Behavior
SNIPE_AIM_AND_FIRE_FAILED SNIPE_AIM_AND_FIRE_FAILED
} SnipeAimAndFireStates_t; } SnipeAimAndFireStates_t;
//------------------------------------ //-------------------------------------
// Parameters // Public Interface
//------------------------------------ //-------------------------------------
private: CLASS_PROTOTYPE(SnipeEnemy);
float _aimTime;
float _lockDownTime;
float _maxTorsoYaw;
float _maxTorsoPitch;
float _maxTorsoTurnSpeed;
int _shots;
SnipeEnemy();
~SnipeEnemy();
void SetArgs(Event* ev);
void AnimDone(Event* ev);
void Begin(Actor& self);
BehaviorReturnCode_t Evaluate(Actor& self);
void End(Actor& self);
// Accessors
virtual void Archive(Archiver& arc);
protected:
//------------------------------------- //-------------------------------------
// Internal Functionality // Internal Functionality
//------------------------------------- //-------------------------------------
protected:
void transitionToState(SnipeAimAndFireStates_t state); void transitionToState(SnipeAimAndFireStates_t state);
void setInternalState(SnipeAimAndFireStates_t state, const str& stateName); void setInternalState(SnipeAimAndFireStates_t state, const str& stateName);
void init(Actor &self); void init(Actor &self);
@ -96,37 +100,25 @@ class SnipeEnemy : public Behavior
BehaviorReturnCode_t evaluateStatePostFire(); BehaviorReturnCode_t evaluateStatePostFire();
void failureStatePostFire(const str& failureReason); void failureStatePostFire(const str& failureReason);
private:
//------------------------------------
//------------------------------------- // Parameters
// Public Interface //------------------------------------
//------------------------------------- float _aimTime;
public: float _lockDownTime;
CLASS_PROTOTYPE( SnipeEnemy ); float _maxTorsoYaw;
float _maxTorsoPitch;
SnipeEnemy(); float _maxTorsoTurnSpeed;
~SnipeEnemy(); int _shots;
void SetArgs ( Event *ev );
void AnimDone ( Event *ev );
void Begin ( Actor &self );
BehaviorReturnCode_t Evaluate ( Actor &self );
void End ( Actor &self );
// Accessors
virtual void Archive ( Archiver &arc );
//------------------------------------- //-------------------------------------
// Components // Components
//------------------------------------- //-------------------------------------
private:
FireWeapon _fireWeapon; FireWeapon _fireWeapon;
//------------------------------------- //-------------------------------------
// Member Variables // Member Variables
//------------------------------------- //-------------------------------------
private:
SnipeAimAndFireStates_t _state; SnipeAimAndFireStates_t _state;
Vector _currentTorsoAngles; Vector _currentTorsoAngles;
float _endAimTime; float _endAimTime;
@ -142,12 +134,9 @@ class SnipeEnemy : public Behavior
Vector _lastGoodPosition; Vector _lastGoodPosition;
Vector _targetSpread; Vector _targetSpread;
Actor* _self; Actor* _self;
}; };
inline void SnipeEnemy::Archive( Archiver &arc ) inline void SnipeEnemy::Archive(Archiver& arc) {
{
Behavior::Archive(arc); Behavior::Archive(arc);
// //