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); } } } }
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; } } } }
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--; } } }