// Update is called once per frame void Update() { _currentScene = SceneManager.GetActiveScene().name; if (_currentScene == Constants.CONNECTION_SCENE) { ActivePlayers = NetworkServer.connections.Count <= 0 ? 0 : NetworkServer.connections.Count - 1; //ActivePlayers = Network.connections.Length; _activePlayersText.text = ActivePlayers.ToString(); _IPText.text = Network.player.ipAddress; //_statusText.text = Network.isServer.ToString(); } if (_currentScene == Constants.GAMEPLAY_SCENE) { if (_justLoaded) { _shipsManager = FindObjectOfType <ShipsManager>(); _shipsManager.InstantiateShips(ActivePlayers, playersChoices.ToArray <Choice>()); _justLoaded = false; } } }
// Use this for initialization void Start() { _shipsManager = FindObjectOfType <ShipsManager>(); playersChoices = new Ships[ActivePlayers]; for (int i = 0; i < playersChoices.Length; i++) { playersChoices[i] = Ships.FAST; } _shipsManager.InstantiateShips(ActivePlayers, this.playersChoices); }