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
//--------------------------------------------------------------
class SnipeEnemy : public Behavior
{
class SnipeEnemy : public Behavior {
public:
//------------------------------------
// States
//------------------------------------
public:
typedef enum
{
typedef enum {
SNIPE_AIM_AND_FIRE_AIM,
SNIPE_AIM_AND_FIRE_PRE_FIRE,
SNIPE_AIM_AND_FIRE_ATTACK,
@ -56,22 +54,28 @@ class SnipeEnemy : public Behavior
SNIPE_AIM_AND_FIRE_FAILED
} SnipeAimAndFireStates_t;
//------------------------------------
// Parameters
//------------------------------------
private:
float _aimTime;
float _lockDownTime;
float _maxTorsoYaw;
float _maxTorsoPitch;
float _maxTorsoTurnSpeed;
int _shots;
//-------------------------------------
// Public Interface
//-------------------------------------
CLASS_PROTOTYPE(SnipeEnemy);
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
//-------------------------------------
protected:
void transitionToState(SnipeAimAndFireStates_t state);
void setInternalState(SnipeAimAndFireStates_t state, const str& stateName);
void init(Actor &self);
@ -96,37 +100,25 @@ class SnipeEnemy : public Behavior
BehaviorReturnCode_t evaluateStatePostFire();
void failureStatePostFire(const str& failureReason);
//-------------------------------------
// Public Interface
//-------------------------------------
public:
CLASS_PROTOTYPE( SnipeEnemy );
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 );
private:
//------------------------------------
// Parameters
//------------------------------------
float _aimTime;
float _lockDownTime;
float _maxTorsoYaw;
float _maxTorsoPitch;
float _maxTorsoTurnSpeed;
int _shots;
//-------------------------------------
// Components
//-------------------------------------
private:
FireWeapon _fireWeapon;
//-------------------------------------
// Member Variables
//-------------------------------------
private:
SnipeAimAndFireStates_t _state;
Vector _currentTorsoAngles;
float _endAimTime;
@ -142,12 +134,9 @@ class SnipeEnemy : public Behavior
Vector _lastGoodPosition;
Vector _targetSpread;
Actor* _self;
};
inline void SnipeEnemy::Archive( Archiver &arc )
{
inline void SnipeEnemy::Archive(Archiver& arc) {
Behavior::Archive(arc);
//