DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
DayZAIHitComponents.c
См. документацию.
1
3{
4 string m_Name;
5 int m_Weight;
6};
7
9{
21 static void RegisterHitComponent(array<ref DayZAIHitComponent> pHitComponents, string pName, float pWeight)
22 {
23 DayZAIHitComponent newComponent = new DayZAIHitComponent();
24
25 newComponent.m_Name = pName;
26 newComponent.m_Weight = pWeight;
27
28 pHitComponents.Insert(newComponent);
29 }
30
40 static bool SelectMostProbableHitComponent(array<ref DayZAIHitComponent> pHitComponents, out string pHitComponent)
41 {
42 int weights = SumOfWeights(pHitComponents);
43 float rnd = Math.RandomInt(0, weights);
44
45 for ( int i = 0; i < pHitComponents.Count(); ++i )
46 {
47 DayZAIHitComponent hitComp = pHitComponents.Get(i);
48 rnd -= hitComp.m_Weight;
49
50 if (rnd <= 0)
51 {
52 pHitComponent = hitComp.m_Name;
53 return true;
54 }
55 }
56
57 return false;
58 }
59
69 {
70 int sum = 0;
71
72 for( int i = 0; i < pHitComponents.Count(); ++i )
73 {
74 DayZAIHitComponent hitComp = pHitComponents.Get(i);
75 sum += hitComp.m_Weight;
76 }
77
78 return sum;
79 }
80};
int m_Weight
"Head", "Torso", etc.
Определения DayZAIHitComponents.c:5
string m_Name
Определения DayZAIHitComponents.c:4
static int SumOfWeights(array< ref DayZAIHitComponent > pHitComponents)
Calculates the sum of all entries in DayZAIHitComponent array.
Определения DayZAIHitComponents.c:68
static void RegisterHitComponent(array< ref DayZAIHitComponent > pHitComponents, string pName, float pWeight)
Register Hit Component for AI targeting.
Определения DayZAIHitComponents.c:21
static bool SelectMostProbableHitComponent(array< ref DayZAIHitComponent > pHitComponents, out string pHitComponent)
Определения DayZAIHitComponents.c:40
holds hit components and its weights for attack from AI (used on each type - DayZPlayerType,...
Определения DayZAIHitComponents.c:3
Определения EnMath.c:7
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].