Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс DayZAIHitComponentHelpers

Закрытые статические члены

static void RegisterHitComponent (array< ref DayZAIHitComponent > pHitComponents, string pName, float pWeight)
 Register Hit Component for AI targeting.
 
static bool SelectMostProbableHitComponent (array< ref DayZAIHitComponent > pHitComponents, out string pHitComponent)
 
static int SumOfWeights (array< ref DayZAIHitComponent > pHitComponents)
 Calculates the sum of all entries in DayZAIHitComponent array.
 

Подробное описание

Методы

◆ RegisterHitComponent()

RegisterHitComponent ( array< ref DayZAIHitComponent > pHitComponents,
string pName,
float pWeight )
inlinestaticprivate

Register Hit Component for AI targeting.

Register Hit Component for AI targeting to array defined on entity's Type (DayZPlayerType, DayZInfectedType, etc.) Uses component name from damage system (zone) and its weight.

Аргументы
[in]pHitComponentsarray that keeps registered compoenents
[in]pNamecomponent name (zone in Damage System)
[in]pWeightweight of the component (probability)
22 {
24
25 newComponent.m_Name = pName;
26 newComponent.m_Weight = pWeight;
27
29 }
holds hit components and its weights for attack from AI (used on each type - DayZPlayerType,...
Definition DayZAIHitComponents.c:3
Definition EntityAI.c:95

Используется в RegisterHitComponentsForAI(), DayZCreatureAI::RegisterHitComponentsForAI() и AnimalBase::RegisterHitComponentsForAI().

◆ SelectMostProbableHitComponent()

static bool SelectMostProbableHitComponent ( array< ref DayZAIHitComponent > pHitComponents,
out string pHitComponent )
inlinestaticprivate
41 {
43 float rnd = Math.RandomInt(0, weights);
44
45 for ( int i = 0; i < pHitComponents.Count(); ++i )
46 {
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 }
static int SumOfWeights(array< ref DayZAIHitComponent > pHitComponents)
Calculates the sum of all entries in DayZAIHitComponent array.
Definition DayZAIHitComponents.c:68
Definition EnMath.c:7
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].

Перекрестные ссылки Math::RandomInt() и SumOfWeights().

Используется в GetHitComponentForAI() и DayZCreatureAI::GetHitComponentForAI().

◆ SumOfWeights()

SumOfWeights ( array< ref DayZAIHitComponent > pHitComponents)
inlinestaticprivate

Calculates the sum of all entries in DayZAIHitComponent array.

Аргументы
[in]pHitComponentsarray that keeps registered compoenents
Возвращает
Sum of weights of all entries in array
69 {
70 int sum = 0;
71
72 for( int i = 0; i < pHitComponents.Count(); ++i )
73 {
75 sum += hitComp.m_Weight;
76 }
77
78 return sum;
79 }

Используется в SelectMostProbableHitComponent().


Объявления и описания членов класса находятся в файле: