Example #1
0
 public void Cmd_Restart()
 {
     if (GameManager.GetInstance().gameOver)
     {
         NetworkGameManager.GetInstance().ServerChangeScene("Game");
         Debug.Log("NetworkGameManagerFound");
         //obj.GetComponent<NetworkGameManager>().ServerChangeScene("Game");
     }
 }
Example #2
0
        /// <summary>
        /// When the server is shut down
        /// </summary>
        /// <param name="connection"></param>
        public override void OnClientDisconnect(NetworkConnection connection)
        {
            ApplicationData.ServerClosed = true;
            NetworkGameManager NetManager = NetworkGameManager.GetInstance();
            MatchInfo          matchInfo  = NetManager.matchInfo;

            NetManager.matchMaker.DropConnection(matchInfo.networkId, matchInfo.nodeId, 0, NetManager.OnDropConnection);
            NetManager.StopHost();

            NetworkGameManager.Shutdown();

            SceneManager.LoadScene(0);
            base.OnClientDisconnect(connection);
        }
Example #3
0
        /// <summary>
        /// Quits the application.
        /// </summary>
        public void Quit()
        {
            ApplicationData.ServerClosed = false;
            NetworkGameManager NetManager = NetworkGameManager.GetInstance();
            MatchInfo          matchInfo  = NetManager.matchInfo;

            NetManager.matchMaker.DropConnection(matchInfo.networkId, matchInfo.nodeId, 0, NetManager.OnDropConnection);
            NetManager.StopHost();

            NetworkGameManager.Shutdown();

            SceneManager.LoadScene(0);
            //SceneManager.LoadScene(0);
        }
Example #4
0
        // Use this for initialization

        void Start()
        {
            NetManager = NetworkGameManager.GetInstance();

            if (NetManager.matchMaker == null)
            {
                NetManager.StartMatchMaker();
            }

            if (ApplicationData.ServerTimeout)
            {
                Status.text = ("Server Connection Timed Out");
            }
            else
            {
                Status.text = "";
            }

            FindMatchButton.enabled = true;

            StartMatchButton.enabled = true;
        }
Example #5
0
 //initialize variables
 void Awake()
 {
     instance = this;
 }