DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ SelectMostProbableHitComponent()

static bool DayZAIHitComponentHelpers::SelectMostProbableHitComponent ( array< ref DayZAIHitComponent > pHitComponents,
out string pHitComponent )
inlinestaticprivate

См. определение в файле DayZAIHitComponents.c строка 40

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 }
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

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

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