Exemplo n.º 1
0
        public void Update(ServerGame game, Lobby lobby)
        {
            foreach (BigShip ship in aiBigShips.ToArray())
            {
                if (ship.IsDestroyed)
                {
                    aiBigShips.Remove(ship);
                }
            }

            while (game.GameObjectCollection.GetMasterList().GetList <SmallShip>().Count < 20)
            {
                SmallShip.SmallShipFactory(game);
            }

            while (game.GameObjectCollection.GetMasterList().GetList <BigShip>().Count < 5)
            {
                aiBigShips.Add(BigShip.BigShipFactory(game));
            }

            ControllerFocusObject controllerFocusObject = game.GameObjectCollection.GetMasterList().GetList <ControllerFocusObject>()[0];

            foreach (Player player in lobby.Clients)
            {
                if (controllerFocusObject.GetFocus(player.Id) == null || controllerFocusObject.GetFocus(player.Id).IsDestroyed)
                {
                    BigShip playerShip = BigShip.BigShipFactory(game, player);
                    CircleBigShips(playerShip.Position);
                }
            }
        }
Exemplo n.º 2
0
        public Ship GetLocalPlayerFocus()
        {
            Ship focus = null;
            List <ControllerFocusObject> controllerFocusList = this.GameObjectCollection.GetMasterList().GetList <ControllerFocusObject>();

            if (controllerFocusList.Count > 0)
            {
                ControllerFocusObject controllerFocus = controllerFocusList[0];
                focus = controllerFocus.GetFocus(serverConnection.Id);
            }
            return(focus);
        }