PageRenderTime 24ms CodeModel.GetById 16ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/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
 1///////////////////////////////////////////////////////////////////////////////////////////////////
 2// GEStatus.h
 3// 2010?1?20?
 4// Copyright ?2007, 2010, 8DWorld, Inc. All rights reserved.
 5//
 6// 
 7///////////////////////////////////////////////////////////////////////////////////////////////////
 8
 9#ifndef GE_STATUS_H
10#define GE_STATUS_H
11
12#include "Gene/GeneE.h"
13#include "Combat/CombatDefinition.h"
14#include "Entity/EntityDefinition.h"
15#include "Move/MoveDefinition.h"
16#include "Combat/CombatSysIf.h"
17
18
19/** 
20*
21*
22*	GEStatus 
23*	Derived from IGene , which can be treat as a complex state. enter state when attach to its host, leave state when detach to it.
24*	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
25*	mean that the unit is in these parallel state, and the unit is the state host.
26*
27*	Complex State is a combination of simple, mutable state, like the move state in Entity will have 3 simple , mutable state: 
28*	state Moving:		unit is moving
29*	state Idle:			unit is stand by and ready to move
30*	state Freeze:		unit is frozen and can't be moved
31*	And a unit in combat will have the following simple, mutable state:
32*	state Peace:		no combat
33*	state Ready:		in combat, ready for casting a spell to its target
34*	state Casting:		in combat, casting a spell on its target
35*	state CoolDown:		in combat, cool down time interval just after a previous spell is casted
36*	state Forbidden:	in combat, forbidden to cast a spell
37*	state Charging:		in combat, approaching to its target for casting a spell
38*	And so on...
39*
40*/
41class TCOM_API  GEStatus : public GeneE
42{
43public:
44	enum
45	{
46		ArgIdx_StateID = 1,
47	};
48
49    GEStatus();
50	virtual ~GEStatus();
51	// 
52	//	Fire when the gene is attached on a unit. just like unit enter the state.
53	//
54	virtual bool onAttach();
55
56	// 
57	//	Fire when the gene is attached on a unit. just like unit enter the state.
58	//
59	virtual bool onDetach();
60
61	// 
62	//	Periodically update gene logic, normally a gene will be detach when run out of its time to live.
63	//
64	virtual bool onUpdate(int nElapse);
65
66protected:
67	ICombatSys*	m_wpCombat;
68	int		m_nStateID;
69
70};
71
72
73#endif // GESTATEAES_H