Esempio n. 1
0
 public Unit(Map myMap, Map enMap, User u, ShipList l)
 {
     this.myMap    = myMap;
     this.enemyMap = enMap;
     this.user     = u;
     this.list     = l;
 }
Esempio n. 2
0
        public bool SetShipsOnMap(Map map, ShipList list)
        {
            Random    rand = new Random();
            int       x;
            int       y;
            int       numDir;
            Direction dir;
            bool      confirm = false;

            foreach (AShip ship in list.activeShips)
            {
                while (!confirm)
                {
                    x      = rand.Next(map.mapSize);
                    y      = rand.Next(map.mapSize);
                    numDir = rand.Next(4);
                    if (numDir == 0)
                    {
                        dir = Direction.right;
                    }
                    else if (numDir == 1)
                    {
                        dir = Direction.left;
                    }
                    else if (numDir == 2)
                    {
                        dir = Direction.down;
                    }
                    else
                    {
                        dir = Direction.up;
                    }
                    if (ship != null)
                    {
                        confirm = map.SetShipOnMap(ship, dir, x, y);
                    }
                    else
                    {
                        confirm = true;
                    }
                }
                ;
                confirm = false;
            }
            return(true);
        }
Esempio n. 3
0
 public bool SetShipsOnMap(Map map, ShipList list)
 {
     return(true);
 }
Esempio n. 4
0
 public bool SetShips(Map map, ShipList list)
 {
     return(user.SetShipsOnMap(map, list));
 }