Beispiel #1
0
        /// <summary>
        /// Disconnect from the current server, or if hosting, stop the server.
        /// </summary>
        public static void Disconnect()
        {
            if (_instance == null)
            {
                Debug.LogError("Signleton not ready. Did you add the GameController to a GameObject?");
                return;
            }

            if (LogFilter.Debug)
            {
                Debug.Log("GameManager singleton shutdown");
            }
            Destroy(_instance.gameObject);
            _instance = null;

            NetworkManager.Shutdown();
        }
Beispiel #2
0
        private void InitializeSingleton()
        {
            if (_instance != null && _instance == this)
            {
                return;
            }
            _instance = this;

            _serverPlayerInfo = new Dictionary <int, PlayerMessage>();
            _clientPlayerData = new PlayerMessage();
            _clientPlayerList = new Dictionary <int, PlayerMessage>();
            _clientGameData   = new GameMessage();
            if (LogFilter.Debug)
            {
                Debug.Log("GameManager singleton setup");
            }
        }