/TGame/TCommon/Gene/Status/GEStatus.h
http://awoe.googlecode.com/ · C Header · 73 lines · 24 code · 11 blank · 38 comment · 0 complexity · 706e5a0358679b10e733c963ef2aa292 MD5 · raw file
- ///////////////////////////////////////////////////////////////////////////////////////////////////
- // GEStatus.h
- // 2010?1?20?
- // Copyright ?2007, 2010, 8DWorld, Inc. All rights reserved.
- //
- //
- ///////////////////////////////////////////////////////////////////////////////////////////////////
-
- #ifndef GE_STATUS_H
- #define GE_STATUS_H
-
- #include "Gene/GeneE.h"
- #include "Combat/CombatDefinition.h"
- #include "Entity/EntityDefinition.h"
- #include "Move/MoveDefinition.h"
- #include "Combat/CombatSysIf.h"
-
-
- /**
- *
- *
- * GEStatus
- * Derived from IGene , which can be treat as a complex state. enter state when attach to its host, leave state when detach to it.
- * Yes, an GEStatus is a complex state model for unit in combat, a unit in combat can have one or more GEStatus at the same time, which
- * mean that the unit is in these parallel state, and the unit is the state host.
- *
- * Complex State is a combination of simple, mutable state, like the move state in Entity will have 3 simple , mutable state:
- * state Moving: unit is moving
- * state Idle: unit is stand by and ready to move
- * state Freeze: unit is frozen and can't be moved
- * And a unit in combat will have the following simple, mutable state:
- * state Peace: no combat
- * state Ready: in combat, ready for casting a spell to its target
- * state Casting: in combat, casting a spell on its target
- * state CoolDown: in combat, cool down time interval just after a previous spell is casted
- * state Forbidden: in combat, forbidden to cast a spell
- * state Charging: in combat, approaching to its target for casting a spell
- * And so on...
- *
- */
- class TCOM_API GEStatus : public GeneE
- {
- public:
- enum
- {
- ArgIdx_StateID = 1,
- };
-
- GEStatus();
- virtual ~GEStatus();
- //
- // Fire when the gene is attached on a unit. just like unit enter the state.
- //
- virtual bool onAttach();
-
- //
- // Fire when the gene is attached on a unit. just like unit enter the state.
- //
- virtual bool onDetach();
-
- //
- // Periodically update gene logic, normally a gene will be detach when run out of its time to live.
- //
- virtual bool onUpdate(int nElapse);
-
- protected:
- ICombatSys* m_wpCombat;
- int m_nStateID;
-
- };
-
-
- #endif // GESTATEAES_H