123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- /** @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,....)
|