public void UpdateBotWithVisibile(Units pBot) { if (pBot == null || !pBot.isLive || pBot.unique_id == this.m_Owner.unique_id) { return; } if (!this.m_MemoryMap.ContainsKey(pBot.unique_id) || this.m_MemoryMap[pBot.unique_id] == null) { MemoryRecord memoryRecord = new MemoryRecord(); memoryRecord.dTimeBecameVisible = (double)Time.time; memoryRecord.dTimeLastSensed = (double)Time.time; memoryRecord.dTimeLastVisible = (double)Time.time; memoryRecord.bWithingFOV = true; memoryRecord.vLastSensedPosition = pBot.transform.position; this.AddToMemory(pBot.unique_id, memoryRecord); } else { MemoryRecord memoryRecord2 = this.m_MemoryMap[pBot.unique_id]; memoryRecord2.dTimeLastSensed = (double)Time.time; memoryRecord2.dTimeLastVisible = (double)Time.time; memoryRecord2.bWithingFOV = true; memoryRecord2.vLastSensedPosition = pBot.transform.position; } }
public List <Units> GetListOfRecentlySensedOpponents(Relation relation, TargetTag tagType = TargetTag.All, bool isVisibile = true, bool isCheckTaunted = false, SortType sortType = SortType.None, FindType findType = FindType.None, object param = null) { this.target_units.Clear(); bool flag = false; for (int i = 0; i < this.m_MemoryId.Count; i++) { int num = this.m_MemoryId[i]; MemoryRecord memoryRecord = this.m_MemoryMap[num]; if (memoryRecord != null) { if (!isVisibile || memoryRecord.bWithingFOV) { Units unit = MapManager.Instance.GetUnit(num); if (unit == null || !unit.isLive) { this.m_MemoryMap[num] = null; } else if (relation == Relation.Hostility) { if (TeamManager.CanAttack(this.m_Owner, unit)) { if (isCheckTaunted && unit.ChaoFeng.IsInState) { this.target_units.Clear(); this.target_units.Add(unit); flag = true; break; } if (TagManager.CheckTag(unit, tagType)) { this.target_units.Add(unit); } } } else if (relation == Relation.Companion && TeamManager.CanAssist(this.m_Owner, unit)) { if (TagManager.CheckTag(unit, tagType)) { this.target_units.Add(unit); } } } } } if (!flag) { if (sortType != SortType.None) { FindTargetHelper.SortTargets(this.m_Owner, sortType, ref this.target_units); } if (findType != FindType.None) { FindTargetHelper.FilterTargetsRef(this.m_Owner, ref this.target_units, findType, param); } } return(this.target_units); }
public void AddToMemory(int unique_id, MemoryRecord record) { if (!this.m_MemoryMap.ContainsKey(unique_id)) { this.m_MemoryId.Add(unique_id); this.m_MemoryMap.Add(unique_id, record); } else { this.m_MemoryMap[unique_id] = record; } }
public void UpdateBotWithSpawned(Units pBot) { if (pBot == null || !pBot.isLive || pBot.unique_id == this.m_Owner.unique_id) { return; } if (!this.m_MemoryMap.ContainsKey(pBot.unique_id) || this.m_MemoryMap[pBot.unique_id] == null) { MemoryRecord memoryRecord = new MemoryRecord(); memoryRecord.dTimeSpawned = (double)Time.time; memoryRecord.dTimeLastSensed = (double)Time.time; memoryRecord.vLastSensedPosition = pBot.transform.position; this.AddToMemory(pBot.unique_id, memoryRecord); this.ResetHatredValue(pBot); } }
public void UpdateBotWithAttack(Units pBot, float damage) { if (pBot == null || !pBot.isLive || pBot.unique_id == this.m_Owner.unique_id) { return; } if (!this.m_MemoryMap.ContainsKey(pBot.unique_id) || this.m_MemoryMap[pBot.unique_id] == null) { MemoryRecord memoryRecord = new MemoryRecord(); memoryRecord.dTimeLastSensed = (double)Time.time; memoryRecord.vLastSensedPosition = pBot.transform.position; this.AddToMemory(pBot.unique_id, memoryRecord); } else { MemoryRecord memoryRecord2 = this.m_MemoryMap[pBot.unique_id]; memoryRecord2.dTimeLastSensed = (double)Time.time; memoryRecord2.vLastSensedPosition = pBot.transform.position; } this.AddHatredValue(pBot, (int)damage * 100); }