public HashSet <SimulatedAgent> GetStationaryAgentsInRangeWithTag(string tag) { var allAgents = AGENT_DB.GetStationaryAgentsWithTag(tag); if (allAgents.Count > 0) { var agentsInRange = new HashSet <SimulatedAgent>(); foreach (var agent in allAgents) { if (agent.transform.gameObject.GetInstanceID().Equals(m_ID)) { continue; } float to = (agent.transform.position - transform.position).sqrMagnitude; if (to < sightDistance * sightDistance) { agentsInRange.Add(agent); } } return(agentsInRange); } return(allAgents); }
private int NumOfVegetationToSpawn() { int numOfVeg = AGENT_DATABASE.GetStationaryAgentsWithTag("Vegetation").Count; return(maxVegetation - numOfVeg); }