Inheritance: IPosition
Beispiel #1
0
    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);
    }
Beispiel #2
0
 private static bool listContainsByReferenceEquals(AgentType agent, ISpatialCollection<AgentType> neighbors)
 {
   foreach(AgentType neighbor in neighbors) {
       if(Object.ReferenceEquals(agent, neighbor)) {
         return true;
       }
   }
   return false;
   
 }
Beispiel #3
0
    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);
    }
Beispiel #4
0
    public AgentType(AgentType agent, Point3d position, Point3d refPosition)
    {

      this.position = position;
      this.refPosition = refPosition;
    }
Beispiel #5
0
 public AgentType(AgentType agent)
 {
   this.position = agent.position;
   this.refPosition = agent.refPosition;
 }
Beispiel #6
0
 public List <Agent> spawnOne(Agent.AgentType type)
 {
     return(spawnOne(type, getValidAgentPosition()));
 }
Beispiel #7
0
 public void spawnAgent(Agent.AgentType type, Vector2 pos)
 {
     mapRenderer.instantiateAgents(worldMap.spawnOne(type, pos));
     worldMap.updateAgentTree();
 }