File size: 3,016 Bytes
24b81cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/** @file 

  this file is interface to AI Behaviour

*/

/*
class AIMessage: Managed

{
	Param m_Parameters;
	int m_CrcMessage;
	Param GetParameters();
	int GetTypeNameCRC();
}

class AIMessageTest : AIMessage
{
	int GetTypeNameCRC() {return testCRC;}
	//static int testCRC = 5;	
}

*/


class AIBehaviourHLData
{
	private void AIBehaviourHLData() {}
	private void ~AIBehaviourHLData() {}
	
	//void ParseConfig(ParamEntryPar param, AIWorld* world, AIAgentTemplate* agentTemplate) {};
	void OnParseConfig();	
	
	//Can be use only inside OnParseConfig function
	proto native void ParseBehaviourSlot(string name);
	proto native void ParseAlertLevel(string name);
	proto native float ReadParamValue(string paramName, float defValue);
	
}


class AIBehaviourHL
{
	private void AIBehaviourHL() {}
	private void ~AIBehaviourHL() {}
	
	proto native AIBehaviourHLData GetTemplateData();
	
	void OnInit(){};
	//private void AIBehaviourHL_script() {};
	//private void ~AIBehaviourHL_script() {};

	void Simulate (float timeDelta)
	{
		//time = time + timeDelta; 
		//Print("A2");
	}
	
	
	//void OnNoise(AINoiseInfo noise, EntityAI source){}
	void OnDamage(float damage, EntityAI source){}

	void OnDamageInflicted(){}
	void OnAnimationEvent(int nameCrc){}
	//void OnMessage(AIMessage message){}
	//void OnBehaviourSwitched(AIBehaviour* behaviour){}
	proto native void SetNextBehaviour(int BehaviourCrc);
	proto native void SwitchToNextBehaviour();
	
	static proto void RegAIBehaviour(string behname,typename behClass, typename behClassData);
};


class AIBehaviourHLZombie2 : AIBehaviourHL
{
	//AIBehaviourHLDataZombie2 data;
	//int state;
	//float time;
	AIBehaviourHLDataZombie2 GetData()
	{
		return AIBehaviourHLDataZombie2.Cast( GetTemplateData() );
	}
	
	private void AIBehaviourHLZombie2() {}
	private void ~AIBehaviourHLZombie2() {}
	
	override void OnInit()
	{
		SetNextBehaviour(0x7b9a4ee9);
		SwitchToNextBehaviour();
		//Print("OnInit");
		//data = GetData();
		//float a = data.m_fDamageToCrawl;
		//Print(a);
	}
	
	override void Simulate (float timeDelta)
	{
		//time = time + timeDelta; 
		//Print("B2");
	}
	
	void ShowDebugInfo() 
	{
		//Print(time);
	};
	
	//void OnMessage(AIMessage message)
	//{
		//int ID = message.GetTypeNameCRC();
		//Print(ID);
		
	//}
};

class AIBehaviourHLDataZombie2 : AIBehaviourHLData
{
	float m_fDamageToCrawl;
	float m_fCrawlProbability;

	private void AIBehaviourHLDataZombie2() {}
	private void ~AIBehaviourHLDataZombie2() {}
	
	override void OnParseConfig()
	{
		Print("zombie data parse config start");
		
		ParseBehaviourSlot("Calm");
		ParseBehaviourSlot("Attracted");
		ParseBehaviourSlot("Disturbed");
		ParseBehaviourSlot("Alerted");
		
		ParseAlertLevel("Calm");
		ParseAlertLevel("Disturbed");
		ParseAlertLevel("Attracted");
		ParseAlertLevel("Alerted");
		
		m_fDamageToCrawl = ReadParamValue("damageToCrawl",0.01);
		m_fCrawlProbability = ReadParamValue("crawlProbability",0.01);
		
		Print("zombie data parse config end");
	}
};

//NewNPC(model,behname,....)