Inheritance: IPosition
Exemplo n.º 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);
    }
Exemplo n.º 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;
   
 }
Exemplo n.º 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);
    }
Exemplo n.º 4
0
    public AgentType(AgentType agent, Point3d position, Point3d refPosition)
    {

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