private bool TrySpawnGroup(HumanAIGroup group) { bool active = group.m_Active; if (group.m_Members.Count == 0) { return(false); } bool flag; if (group.IsPatrol()) { flag = (((HumanAIPatrol)group).GetClosestPathPointInRange(this.m_MinActivationDistance, this.m_MaxActivationDistance) != null); } else { float num = 0f; flag = (group.GetClosestMember(out num) && num <this.m_MaxActivationDistance && num> this.m_MinActivationDistance); } if (flag) { group.Activate(); return(true); } return(false); }
private void Update() { for (int i = 0; i < this.m_NoBalanceGroups.Count; i++) { HumanAIGroup group = this.m_NoBalanceGroups[i]; if (this.CheckGroup(group)) { break; } } if (this.CanSpawnGroupFromBalanceSystem()) { for (int j = 0; j < this.m_BalancePatrols.Count; j++) { HumanAIPatrol group2 = this.m_BalancePatrols[j]; if (this.CheckPatrol(group2)) { break; } } for (int k = 0; k < this.m_BalanceGroups.Count; k++) { HumanAIGroup group3 = this.m_BalanceGroups[k]; if (this.CheckGroup(group3)) { break; } } } }
private void Start() { List <HumanAIGroup> componentsDeepChild = General.GetComponentsDeepChild <HumanAIGroup>(base.gameObject); for (int i = 0; i < componentsDeepChild.Count; i++) { HumanAIGroup humanAIGroup = componentsDeepChild[i]; if (!humanAIGroup.m_ChallengeGroup) { if (humanAIGroup.m_FromBalance) { if (humanAIGroup.IsPatrol()) { this.m_BalancePatrols.Add((HumanAIPatrol)humanAIGroup); } else { this.m_BalanceGroups.Add(humanAIGroup); } } else { this.m_NoBalanceGroups.Add(humanAIGroup); } humanAIGroup.Initialize(); humanAIGroup.gameObject.SetActive(false); } } }
public void OnDestroyGroup(HumanAIGroup group) { this.m_BalanceGroups.Remove(group); if (group.IsPatrol()) { this.m_BalancePatrols.Remove((HumanAIPatrol)group); } this.m_NoBalanceGroups.Remove(group); }
public void OnDeactivateGroup(HumanAIGroup group) { if (this.m_ActiveGroup != group && this.m_ActiveCampGroup != group) { Debug.Log("OnDeactivateGroup - Inactive group!"); return; } if (this.m_ActiveGroup == group) { this.m_ActiveGroup = null; this.m_TimeToNextSpawnGroup = this.m_GroupSpawnCooldown; return; } this.m_ActiveCampGroup = null; }
private bool CheckGroup(HumanAIGroup group) { if (group.m_Active) { return(false); } float num = 0f; HumanAI closestMember = group.GetClosestMember(out num); bool flag = closestMember && num <this.m_MaxActivationDistance && num> this.m_MinActivationDistance; if (flag) { group.Activate(); return(true); } return(false); }