Esempio n. 1
0
 public void getTargets()
 {
     for (int i = 0; i < creatures.Count(); i++)
     {
         if (creatures[i].GetType() == typeof(BasicCreature))
         {
             BasicCreature c = (BasicCreature)creatures[i];
             if (!c.isDead() && !allcreatures.Contains(c) && allcreatures.Count() <= 5)
             {
                 allcreatures.Add(c);
             }
         }
     }
 }
Esempio n. 2
0
        public void findTarget()
        {
            int distanceToTower = -9999;

            for (int i = 0; i < creatures.Count(); i++)
            {
                if (creatures[i].GetType() == typeof(BasicCreature))
                {
                    BasicCreature c = (BasicCreature)creatures[i];
                    if (c.getPosition().getX() + c.getPosition().getY() > distanceToTower && !c.isDead())
                    {
                        distanceToTower = c.getPosition().getX() + c.getPosition().getY();
                        target          = c;
                    }
                }
            }
        }
Esempio n. 3
0
 private void spawnCreature()
 {
     if (getAmountOfBugsInArray() <= howManyToSpawn)
     {
         if (timeTillNextSpawn <= 0)
         {
             BasicCreature newBug = new BasicCreature(getPositionOfNewBug(), graph.getFinalTargetLocationNode(),
                                                      graph, 100, 100, world);
             lock (myCollection.SyncRoot)
             {
                 arrayOfObject.Add(newBug);
             }
             resetTimeTillNextSpawn();
         }
         else
         {
             timeTillNextSpawn--;
         }
     }
 }