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); } } }
public void SpawnSmallShip(float spawnTime) { Instantiate(smallShip, RandomPosition(), Quaternion.identity); smallShipScript = FindObjectOfType <SmallShip>(); smallShipScript.DestroyShip(spawnTime - 1); }