/// <summary> /// Takes in a list of ranges(in degrees)(minAngle, maxAngle), each range specifying a pie slice /// </summary> /// <param name="ranges"></param> public PieSliceSensor(List<Tuple<float, float>> ranges, AgentAdjacencyList agentAdjacencyList) { m_AdjacencyList = agentAdjacencyList; //create pie slices m_PieSlices = new List<PieSlice>(); m_NumSlices = ranges.Count; for (int i = 0; i < m_NumSlices; i++) { //create new slice PieSlice p = new PieSlice(ranges[i].Item1, ranges[i].Item2); //insert p m_PieSlices.Add(p); } m_CurrentAngle = ((Agent)m_AdjacencyList.Owner).Heading; m_PreviousAngle = m_CurrentAngle; }
public void InitializeAdjacencyListNodes() { m_AdjacencyListNodes = new AgentAdjacencyList(this, m_World.Nodes, 50); }
public void InitializeAdjacencyListEnemies() { List<GameEntity> enemies = new List<GameEntity>(); for (int i = 0; i < m_World.Agents.Count; i++) { if(m_World.Agents[i].ID != m_ID) { //add to enemy list enemies.Add(m_World.Agents[i]); } } if (m_World.Player != null && m_World.Player.ID != m_ID) { enemies.Add(m_World.Player); } m_AdjacencyListEnemies = new AgentAdjacencyList(this, enemies, 400); }
public void InitializeAdjacencyListBombs() { m_AdjacencyListBombs = new AgentAdjacencyList(this, m_World.Bombs, 50); }