Exemplo n.º 1
0
 public bool UseStructure(bbAgent a)
 {
     // replace this with the structure
     pos.game.currentIsland.structures.Remove(pos);
     pos.game.currentIsland.AddStructure(getStructureTypeFromClickType(), pos.gridLoc.x(), pos.gridLoc.y(), clickType);
     return(true);
 }
Exemplo n.º 2
0
 public override void TakeTurn()
 {
     if (!spawned)
     {
         spawned = true;
         bbAgent newAgent = new bbAgent("Agent" + (1 + pos.game.playerAgents.Count), pos, pos.game, this);
         pos.game.playerAgents.Add(newAgent);
     }
 }
Exemplo n.º 3
0
 public bool checkJobComplete(bbAgent _agent)
 {
     if (_agent.pos == target)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 4
0
 public void doJobTurn(bbAgent agent)
 {
     if (structure.getPos() == agent.pos)
     {
         jobComplete = structure.UseStructure(agent);
     }
     else
     {
         bbJobMoveTo move = new bbJobMoveTo(structure.getPos());
         agent.jobQueue.Insert(0, move);
     }
 }
Exemplo n.º 5
0
 public void doJobTurn(bbAgent _agent)
 {
     path = _agent.pos.findPath(target);
     if (path != null && path.Count != 0)
     {
         if (_agent.pos == path[0])
         {
             path.Remove(_agent.pos);
         }
         _agent.lastPos = _agent.pos;
         _agent.pos     = path[0];
     }
 }
Exemplo n.º 6
0
 bool GetAgentAtPos(bbPos pos, out bbAgent myAgent)
 {
     foreach (bbAgent agent in playerAgents)
     {
         if (agent.pos == pos)
         {
             myAgent = agent;
             return(true);
         }
     }
     myAgent = new bbAgent();
     return(false);
 }
Exemplo n.º 7
0
 public bool UseStructure(bbAgent a)
 {
     if (pos.game.playerResources[ItemType.ITEM_FOOD] >= a.needQuantity[ItemType.ITEM_FOOD])
     {
         pos.game.playerResources[ItemType.ITEM_FOOD] -= a.needQuantity[ItemType.ITEM_FOOD];
         a.needTimer[ItemType.ITEM_FOOD] = 50;
         a.needsAddressing.Remove(ItemType.ITEM_FOOD);
         return(true);
     }
     else
     {
         a.alive = false;
         Debug.Log(a.name + " died of starvation");
         return(false);
     }
 }
Exemplo n.º 8
0
        bool SelectAgent(bbPos pos, out bbAgent selectedAgent)
        {
            bool    clickDidSomething = false;
            bbAgent agentAtPos;

            if (GetAgentAtPos(pos, out agentAtPos))
            {
                selectedAgent     = agentAtPos;
                clickDidSomething = true;
            }
            else
            {
                selectedAgent = null;
            }
            return(clickDidSomething);
        }
Exemplo n.º 9
0
        public void TakeTurn()
        {
            List <bbAgent> dead = new List <bbAgent>();

            for (int i = 0; i < playerAgents.Count; i++)
            {
                bbAgent agent = playerAgents[i];
                agent.takeTurn();
                if (!agent.alive)
                {
                    dead.Add(agent);
                }
            }
            foreach (bbAgent a in dead)
            {
                playerAgents.Remove(a);
            }
            foreach (bbStructure s in currentIsland.structures.Values)
            {
                s.TakeTurn();
            }
            turnNumber++;
        }
Exemplo n.º 10
0
 public bool UseStructure(bbAgent a)
 {
     return(true);
 }
Exemplo n.º 11
0
 public abstract bool UseStructure(bbAgent a);
Exemplo n.º 12
0
 public override bool UseStructure(bbAgent a)
 {
     hasResource = false;
     jobQueued   = false;
     return(a.Collect(ItemType.ITEM_GOLD));
 }
Exemplo n.º 13
0
 public bool UseStructure(bbAgent a)
 {
     return(a.Deposit());
 }
Exemplo n.º 14
0
 public bool checkJobComplete(bbAgent agent)
 {
     return(jobComplete);
 }