Exemplo n.º 1
0
    public ArrayList LoseBots(int num, Transform destination)
    {
        ArrayList botsUsed = new ArrayList();
        int       numToUse = num;

        if (num > bots)
        {
            return(null);
        }
        for (int i = 0; i < totalBots.Count; i++)
        {
            GameObject  bot       = totalBots[i];
            BotMovement botScript = bot.GetComponent <BotMovement>();
            if (botScript.GetState() == BotMovement.BotMode.Follow || botScript.GetState() == BotMovement.BotMode.Stopped)
            {
                botScript.SetDest(destination);
                botScript.SetState(BotMovement.BotMode.Build);
                numToUse--;
                botsUsed.Add(i);
                if (numToUse == 0)
                {
                    break;
                }
            }
        }
        bots -= num;
        overlayScript.setNumBots(bots);
        return(botsUsed);
    }
Exemplo n.º 2
0
 public void RegainBots(int num, ArrayList botList, Vector3 buildPadPosition, bool isSwitch)
 {
     for (int i = 0; i < botList.Count; i++)
     {
         GameObject  usedBot   = totalBots[(int)botList[i]];
         BotMovement botScript = usedBot.GetComponent <BotMovement>();
         usedBot.SetActive(true);
         if (botScript != null)
         {
             if (!isSwitch)
             {
                 botScript.JumpToPad(buildPadPosition);
             }
             else
             {
                 botScript.ReactivateNavMeshAgent();
             }
             botScript.SetState(BotMovement.BotMode.Follow);
         }
     }
     bots += num;
     overlayScript.setNumBots(bots);
 }