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

/TGame/TCommon/Combat/States/CombatState.h

http://awoe.googlecode.com/
C++ Header | 72 lines | 33 code | 13 blank | 26 comment | 0 complexity | 36ced661dbbb2c528cc1444b96954f8a MD5 | raw file
 1
 2#ifndef CombatSysStateIf_H
 3#define CombatSysStateIf_H
 4
 5#include "Entry/LibExportCom.h"
 6#include "Move/MoveDefinition.h"
 7#include "Combat/CombatDefinition.h"
 8#include "Entity/EntityDefinition.h"
 9
10class IEvt;
11class CombatSysImp;
12class IEntity;
13
14/*
15*
16*	CombatState Interface
17
18*	Combat State:
19*	state Peace:		no combat
20*	state Ready:		in combat, ready for casting a spell to its target
21*	state Casting:		in combat, casting a spell on its target
22*	state CoolDown:		in combat, cool down time interval just after a previous spell is casted
23*	state Forbidden:	in combat, forbidden to cast a spell
24*	state Charging:		in combat, approaching to its target for casting a spell
25*/
26class TCOM_API  ICombatState
27{
28public:
29	ICombatState()
30		:m_nTTL(0),
31		m_wpEntity(NULL),
32		m_wpCombat(NULL)
33	{}
34	virtual ~ICombatState(){;}
35
36	//
37	//
38	void init(CombatSysImp* pCombat, IEntity* pEntity)
39	{
40		m_wpCombat = pCombat;
41		m_wpEntity = pEntity;
42	}
43
44	// 
45	//	Fire when enter a new state
46	//
47	virtual void enter() = 0;
48
49	// 
50	//	Fire just before leaving a state
51	//
52	virtual void leave() = 0;
53
54	// 
55	//	update in current state
56	//
57	virtual bool update(int nElapse) = 0;
58
59	// 
60	//	onEvent callback in current state
61	//
62	virtual void onEvent(IEvt& evt) = 0;
63protected:
64	int				m_nTTL;	//	Time To Live
65	CombatSysImp*	m_wpCombat;
66	IEntity*		m_wpEntity;
67};
68
69
70
71
72#endif // CombatSys_H