This commit is contained in:
Walter Julius Hennecke 2014-03-09 22:37:57 +01:00
parent 51e9513177
commit d8bb50f96e

View file

@ -44,14 +44,12 @@ class GeneralCombatWithRangedWeapon;
// Method of Use: State machine or another behavior
//--------------------------------------------------------------
class RangedCombatWithWeapon : public Behavior
{
class RangedCombatWithWeapon : public Behavior {
public:
//------------------------------------
// States
//------------------------------------
public:
typedef enum
{
typedef enum {
RCWW_EVALUATE_OPTIONS,
RCWW_CHANGE_WEAPON,
RCWW_GENERAL_COMBAT,
@ -61,21 +59,31 @@ class RangedCombatWithWeapon : public Behavior
} RangedCombatWithWeapon_t;
//------------------------------------
// Parameters
//------------------------------------
private:
str _aimAnim; // --Animation used to aim the weapon
str _fireAnim; // --The animation used to fire the weapon
float _approachDist;
float _retreatDist;
float _strafeChance;
float _postureChangeChance;
//-------------------------------------
// Public Interface
//-------------------------------------
CLASS_PROTOTYPE(RangedCombatWithWeapon);
RangedCombatWithWeapon();
~RangedCombatWithWeapon();
void SetArgs(Event* ev);
void AnimDone(Event* ev);
void PostureDone(Event* ev);
void Begin(Actor& self);
BehaviorReturnCode_t Evaluate(Actor& self);
void End(Actor& self);
virtual void Archive(Archiver& arc);
// Mutators
void SetFireAnim(const str& anim);
protected:
//-------------------------------------
// Internal Functionality
//-------------------------------------
protected:
void transitionToState(RangedCombatWithWeapon_t state);
void setInternalState(RangedCombatWithWeapon_t state, const str& stateName);
void init(Actor& self);
@ -107,36 +115,20 @@ class RangedCombatWithWeapon : public Behavior
BehaviorReturnCode_t evaluateStateCorridorCombat();
void failureStateCorridorCombat();
//-------------------------------------
// Public Interface
//-------------------------------------
public:
CLASS_PROTOTYPE( RangedCombatWithWeapon );
RangedCombatWithWeapon();
~RangedCombatWithWeapon();
void SetArgs ( Event *ev );
void AnimDone ( Event *ev );
void PostureDone ( Event *ev );
void Begin ( Actor &self );
BehaviorReturnCode_t Evaluate ( Actor &self );
void End ( Actor &self );
virtual void Archive ( Archiver &arc );
// Mutators
void SetFireAnim ( const str &anim );
private:
//------------------------------------
// Parameters
//------------------------------------
str _aimAnim; // --Animation used to aim the weapon
str _fireAnim; // --The animation used to fire the weapon
float _approachDist;
float _retreatDist;
float _strafeChance;
float _postureChangeChance;
//-------------------------------------
// Member Variables
//-------------------------------------
private:
// Component Behaviors
CloseInOnEnemy _gotoEnemy;
GeneralCombatWithRangedWeapon _generalCombat;
@ -144,7 +136,6 @@ class RangedCombatWithWeapon : public Behavior
CoverCombatWithRangedWeapon _coverCombat;
SelectBestWeapon _selectBestWeapon;
// Member Vars
int _state; //-- Maintains our Behavior's current State
Actor* _self;
@ -152,12 +143,10 @@ class RangedCombatWithWeapon : public Behavior
float _nextSelectWeaponTime;
float _recheckTime;
// Constants
};
inline void RangedCombatWithWeapon::Archive( Archiver &arc )
{
inline void RangedCombatWithWeapon::Archive(Archiver& arc) {
Behavior::Archive(arc);
// Archive Parameters
@ -183,8 +172,7 @@ inline void RangedCombatWithWeapon::Archive( Archiver &arc )
arc.ArchiveFloat(&_recheckTime);
}
inline void RangedCombatWithWeapon::SetFireAnim( const str &anim )
{
inline void RangedCombatWithWeapon::SetFireAnim(const str &anim) {
_fireAnim = anim;
}