public List <Agent> spawnOne(Agent.AgentType type, Vector2 pos) { List <Agent> newAgent = new List <Agent>(); // for now just ignore spawns in buildings. if (!isValidPosition(pos)) { return(newAgent); } Agent tempAgent; tempAgent = new Agent(type); tempAgent.Location = (pos); agents.Add(tempAgent); newAgent.Add(tempAgent); switch (type) { case Agent.AgentType.HUMAN: livingCount++; break; case Agent.AgentType.HUMAN_PLAYER: livingCount++; break; case Agent.AgentType.ZOMBIE: undeadCount++; break; case Agent.AgentType.ZOMBIE_PLAYER: undeadCount++; break; case Agent.AgentType.CORPSE: corpseCount++; break; default: break; } updateAgentTree(); return(newAgent); }
private static bool listContainsByReferenceEquals(AgentType agent, ISpatialCollection<AgentType> neighbors) { foreach(AgentType neighbor in neighbors) { if(Object.ReferenceEquals(agent, neighbor)) { return true; } } return false; }
public bool Equals(AgentType p) { // If parameter is null return false: if ((object)p == null) { return false; } // Return true if the fields match: return this.position.Equals(p.position) && this.refPosition.Equals(p.refPosition); }
public AgentType(AgentType agent, Point3d position, Point3d refPosition) { this.position = position; this.refPosition = refPosition; }
public AgentType(AgentType agent) { this.position = agent.position; this.refPosition = agent.refPosition; }
public List <Agent> spawnOne(Agent.AgentType type) { return(spawnOne(type, getValidAgentPosition())); }
public void spawnAgent(Agent.AgentType type, Vector2 pos) { mapRenderer.instantiateAgents(worldMap.spawnOne(type, pos)); worldMap.updateAgentTree(); }