My Project
SequenceEntity.h
1 #pragma once
2 #include "AssetEntity.h"
3 #include <vector>
4 #include <map>
5 
6 namespace ParaEngine
7 {
8  using namespace std;
11  class SequenceEntity : public AssetEntity
12  {
13  public:
15  SequenceEntity(const AssetKey& key);
16  virtual ~SequenceEntity();
17 
18  enum CommandType
19  {
20  CMD_RunTo,// void RunTo(int x,int y,int z), relative to current position
21  CMD_WalkTo,// void WalkTo(int x,int y,int z), relative to current position
22  CMD_MoveTo,// void MoveTo(int x,int y,int z), relative to current position
23  CMD_PlayAnim,//void PlayAnim(string sAnim)
24  CMD_Wait, // void Wait(float fSeconds)
25  CMD_Exec, // void Exec()
26  CMD_Pause, // void Pause()
27  CMD_Turn, // void Turn(float fAngleAbsolute)
28  CMD_MoveForward, // void Move(fDistance)
29  CMD_MoveBack, // void Move(fDistance)
30  CMD_MoveLeft, // void Move(fDistance)
31  CMD_MoveRight, // void Move(fDistance)
32  CMD_Jump, // void Jump();
33  CMD_Goto, // void Goto(int nOffset)
34  CMD_Invaild,
35  };
36  enum SEQ_PLAYMODE
37  {
38  PLAYMODE_FORWORD,
39  PLAYMODE_FORWORD_LOOPED,
40  PLAYMODE_BACKWORD,
41  PLAYMODE_BACKWORD_LOOPED,
42  PLAYMODE_ZIGZAG, // first forward and then backward repeatedly
43  };
45  struct SequenceItem
46  {
47  SequenceItem():m_commandtype(CMD_Invaild), m_vPos_R(0,0,0){};
48  SequenceItem(CommandType type):m_commandtype(type), m_vPos_R(0,0,0){};
49  CommandType m_commandtype;
55  float m_fFacing;
56 
58  string m_strParam;
59 
61  union{
62  int m_nGotoOffset;
63  float m_fWaitSeconds;
64  float m_fMoveDistance;
65  DWORD m_dwValue;
66  };
67  };
68  vector<SequenceItem> m_items;
69 
71  string m_description;
73  SEQ_PLAYMODE m_nPlayMode;
78 
80  map<string, int> m_lables;
81  public:
82  virtual HRESULT InitDeviceObjects();
83  virtual HRESULT DeleteDeviceObjects();
84  virtual void Cleanup();
86  void Reset();
87 
89  string ToString();
90 
92  void PushItem(const SequenceItem& item){m_items.push_back(item);};
94  void AddLable(const string& sLable);
96  int GetLableIndex(const string& sLable);
97 
99  SequenceItem& GetItem(int nIndex){return m_items[nIndex];};
101  int GetTotalKeys(){return (int)m_items.size();};
105  bool DeleteKeysRange(int nFrom, int nTo);
106 
107  protected:
109  void CompileKeys();
110  friend class CSequenceCtler;
111  };
112 }
3-dimensional vector with double precision.
Definition: ParaDVector3.h:17
different physics engine has different winding order.
Definition: EventBinding.h:32
Vector3 m_vPos_R
objective position relative to the last one
Definition: SequenceEntity.h:51
int GetTotalKeys()
get total key count
Definition: SequenceEntity.h:101
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
string m_strParam
any string parameter associated with the command
Definition: SequenceEntity.h:58
a reusable entity of sequence which contains an array of sequence items.
Definition: SequenceEntity.h:11
float m_fFacing
objective absolute facing
Definition: SequenceEntity.h:55
DVector3 m_vStartPos
initial position in world coordinate
Definition: SequenceEntity.h:75
string m_description
description
Definition: SequenceEntity.h:71
a sequence item or command
Definition: SequenceEntity.h:45
SEQ_PLAYMODE m_nPlayMode
whether how sequence should be played.
Definition: SequenceEntity.h:73
void PushItem(const SequenceItem &item)
add a new item
Definition: SequenceEntity.h:92
map< string, int > m_lables
Label mapping: <sLabel, nIndex>
Definition: SequenceEntity.h:80
std::string AssetKey
the unique key object for asset entity.
Definition: AssetEntity.h:13
float m_fStartFacing
initial facing
Definition: SequenceEntity.h:77
A sequence controller is a biped controller which moves the biped according to some predefined sequen...
Definition: SequenceCtler.h:11
SequenceItem & GetItem(int nIndex)
nIndex must be valid.
Definition: SequenceEntity.h:99
Base class for managed asset entity in ParaEngine.
Definition: AssetEntity.h:25
DVector3 m_vPos
objective position relative to the start of the sequence.
Definition: SequenceEntity.h:53