My Project
SequenceCtler.h
1 #pragma once
2 #include "BipedController.h"
3 
4 namespace ParaEngine
5 {
6  using namespace std;
7  class SequenceEntity;
8  class CBipedObject;
9 
12  {
13  public:
15  CSequenceCtler(CAIBase* pAI);
16  virtual ~CSequenceCtler(void);
17  public:
21  virtual void FrameMove(float fDeltaTime);
22 
23  bool Save(bool bOverride);
24  bool Load(int nSequenceID);
25  bool Load(const string& fileName);
26  int Create(const string& name, const string& description, const char* pData,bool bInMemory);
27  string ToString();
28 
30  int GetKeyPos(){return m_nKeyPos;};
32  void SetKeyPos(int nPos);
33 
35  int GetTotalKeys();
40  int AdvanceKey(int nOffset);
42  void BeginAddKeys();
44  void EndAddKeys();
46  int GetSequenceID();
50  bool DeleteKeysRange(int nFrom, int nTo);
51 
53  bool GetPlayDirection(){return m_bForward;};
55  void SetPlayDirection(bool bForward){m_bForward = bForward;};
56 
58  float GetInterval(){return m_fMinInterval;}
60  void SetInterval(float fInterval){m_fMinInterval = fInterval;}
61 
63  Vector3 GetStartPos(){return m_vStartPos;}
65  void SetStartPos(const Vector3& vPos){m_vStartPos = vPos;}
66 
68  float GetStartFacing(){return m_fStartFacing;}
70  void SetStartFacing(float facing){m_fStartFacing = facing;}
71 
73  int GetPlayMode(){return (int)m_nPlayMode;}
75  void SetPlayMode(int mode);
76 
79  float GetMovingTimeout(){return m_fMovingTimeOut;}
82  void SetMovingTimeout(float fTimeout){m_fMovingTimeOut=fTimeout;}
83 
85  // commands:
86  public:
88  void RunTo(double x, double y, double z);
90  void WalkTo(double x, double y, double z);
92  void MoveTo(double x, double y, double z);
94  void MoveAndTurn(double x, double y, double z, float facing);
96  void PlayAnim(const string& sAnim);
98  void PlayAnim(int nAnimID);
100  void Wait(float fSeconds);
102  void Exec(const string& sCmd);
104  void Pause();
106  void Turn(float fAngleAbsolute);
108  void MoveForward(float fDistance);
110  void MoveBack(float fDistance);
112  void MoveLeft(float fDistance);
114  void MoveRight(float fDistance);
116  void Jump();
118  void Goto(int nOffset);
120  void Goto(const string& sLable);
122  void Lable(const string& sLable);
123 
131  static void MoveCommand(CBipedObject* pBiped, const DVector3& vDest, bool bForceRun=false, bool bForceWalk=false, float * pFacing=NULL);
136  static void Stop(CBipedObject* pBiped);
137 
138  private:
139  asset_ptr<SequenceEntity> m_pSequenceEntity;
140 
141  enum SEQ_STATE{
142  SEQ_EMPTY, // empty
143  SEQ_CREATED, // only resides in memory
144  SEQ_MANAGED, // is being managed by the manager
145  }m_nSequenceState;
147  string m_name;
149  string m_description;
151  int m_nPlayMode;
153  Vector3 m_vStartPos;
155  float m_fStartFacing;
156  int m_nKeyPos;
157  bool m_bIsAddingKey;
159  bool m_bForward;
161  float m_fMinInterval;
162  float m_fUnprocessedTime;
164  float m_fItemDuration;
167  float m_fMovingTimeOut;
169  float m_fTurningTimeOut;
170 
172  void CopyEntityParamter(const SequenceEntity& e);
174  void SetEntity(SequenceEntity* e);
175  };
176 
177 }
void SetMovingTimeout(float fTimeout)
set the number of seconds after which all move commands will be treated as finished.
Definition: SequenceCtler.h:82
float GetInterval()
the minimum time between two successive calls.
Definition: SequenceCtler.h:58
3-dimensional vector with double precision.
Definition: ParaDVector3.h:17
void SetStartPos(const Vector3 &vPos)
set the starting position.
Definition: SequenceCtler.h:65
float GetStartFacing()
get the start facing.
Definition: SequenceCtler.h:68
different physics engine has different winding order.
Definition: EventBinding.h:32
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
void SetInterval(float fInterval)
the minimum time between two successive calls.
Definition: SequenceCtler.h:60
void SetPlayDirection(bool bForward)
set the play direction.
Definition: SequenceCtler.h:55
bool GetPlayDirection()
get the play direction.
Definition: SequenceCtler.h:53
float GetMovingTimeout()
get the number of seconds after which all move commands will be treated as finished.
Definition: SequenceCtler.h:79
a reusable entity of sequence which contains an array of sequence items.
Definition: SequenceEntity.h:11
Vector3 GetStartPos()
get the starting position.
Definition: SequenceCtler.h:63
Base Interface for Biped controller.
Definition: BipedController.h:18
int GetKeyPos()
Get the current absolute playing cursor position.
Definition: SequenceCtler.h:30
void SetStartFacing(float facing)
Set the start facing.
Definition: SequenceCtler.h:70
base class for all AI objects
Definition: AIBase.h:9
int GetPlayMode()
get the current play mode
Definition: SequenceCtler.h:73
A sequence controller is a biped controller which moves the biped according to some predefined sequen...
Definition: SequenceCtler.h:11
It can be used to represent biped object(like human, re spawning monsters) in the scene without inher...
Definition: BipedObject.h:60