Esempio n. 1
0
 public static Map GetRandomInstance3(int objCount, int width, int height)
 {
     Map map = new Map(width, height);
       Random r = new Random();
       for (int i=0; i<objCount; i++)
       {
       int allegianceNo = r.Next(3);
       Allegiance allegiance = Allegiance.Neutral;
       switch (allegianceNo)
       {
           case 0:
               allegiance = Allegiance.Player;
               break;
           case 1:
               allegiance = Allegiance.Neutral;
               break;
           case 2:
               allegiance = Allegiance.Computer;
               break;
       }
       int sizeNo = r.Next(3);
       PlanetSize size = PlanetSize.Medium;
       switch (sizeNo)
       {
           case 0:
               size = PlanetSize.Small;
               break;
           case 1:
               size = PlanetSize.Medium;
               break;
           case 2:
               size = PlanetSize.Large;
               break;
       }
       int noOfMinions = r.Next(50);
       int type = r.Next(6);
       int x = r.Next(width);
       int y = r.Next(height);
       Vector2 pos = new Vector2(x, y);
       GameObject unit = null;
       switch (type)
       {
           case 0:
               unit = new Asteroid(pos);
               break;
           case 1:
               unit = new DeathStar(pos, allegiance, noOfMinions);
               break;
           case 2:
               unit = new Defender(pos,allegiance);
               break;
           case 3:
               unit = new Interceptor(pos, allegiance);
               break;
           case 4:
               unit = new Planet(pos, allegiance, size, noOfMinions);
               break;
           case 5:
               unit = new Predator(pos, allegiance);
               break;
       }
       if (unit != null) map.mInitialGameObjects.Add(unit);
       }
       return map;
 }
Esempio n. 2
0
 public Asteroid CreateAsteroid(Vector2 position)
 {
     var unit = new Asteroid(position);
       return unit;
 }