This commit is contained in:
Walter Julius Hennecke 2014-03-09 23:06:51 +01:00
parent 5477f6b6b8
commit aeb607dfb8

View file

@ -38,14 +38,12 @@ class UseAlarm;
//
// Method of Use: Statemachine or another behavior
//--------------------------------------------------------------
class UseAlarm : public Behavior
{
class UseAlarm : public Behavior {
public:
//------------------------------------
// States
//------------------------------------
public:
typedef enum
{
typedef enum {
USE_ALARM_FIND_NODE,
USE_ALARM_MOVE_TO_NODE,
USE_ALARM_AT_NODE,
@ -55,17 +53,27 @@ class UseAlarm : public Behavior
USE_ALARM_FAILED
} useAlarmStates_t;
//------------------------------------
// Parameters
//------------------------------------
private: // Parameters
str _movementAnimName ; // anim to play to move to work node, default is "walk"
float _maxDistance; // maximum distance to look for node
//-------------------------------------
// Public Interface
//-------------------------------------
CLASS_PROTOTYPE(UseAlarm);
UseAlarm();
~UseAlarm();
void SetArgs(Event* ev);
void AnimDone(Event* ev);
void HandleNodeCommand(Event* ev);
void Begin(Actor& self);
BehaviorReturnCode_t Evaluate(Actor& self);
void End(Actor& self);
virtual void Archive(Archiver& arc);
protected:
//-------------------------------------
// Internal Functionality
//-------------------------------------
protected:
void transitionToState(useAlarmStates_t state);
void setInternalState(useAlarmStates_t state, const str& stateName);
void init(Actor &self);
@ -92,38 +100,25 @@ class UseAlarm : public Behavior
void failureStateRotateToEnemy(const str& failureReason);
//-------------------------------------
// Public Interface
//-------------------------------------
public:
CLASS_PROTOTYPE( UseAlarm );
UseAlarm();
~UseAlarm();
private:
//------------------------------------
// Parameters
//------------------------------------
str _movementAnimName; // anim to play to move to work node, default is "walk"
float _maxDistance; // maximum distance to look for node
void SetArgs ( Event *ev );
void AnimDone ( Event *ev );
void HandleNodeCommand ( Event *ev );
void Begin ( Actor &self );
BehaviorReturnCode_t Evaluate ( Actor &self );
void End ( Actor &self );
virtual void Archive ( Archiver &arc );
private: // Component Behaviors
// Component Behaviors
GotoHelperNode _gotoHelperNode;
RotateToEntity _rotateToEntity;
private: // Member Variables
// Member Variables
HelperNodePtr _node;
unsigned int _state;
bool _animDone;
Actor* _self;
};
inline void UseAlarm::Archive( Archiver &arc )
{
inline void UseAlarm::Archive(Archiver& arc) {
Behavior::Archive(arc);
// Archive Parameters