void OnGUI()
        {
            GUILayout.Label("State Hash: " + AgentController.GetStateHash());

            if (LockstepManager.MainNetworkHelper != null && LockstepManager.MainNetworkHelper.IsConnected)
            {
                return;
            }
            #region Setting IP and RoomSize via GUI
            GUILayout.BeginVertical(GUILayout.Width(300f));
            GUILayout.Label("Time: " + Time.time.ToString());
            GUI.color = Color.white;
            GUILayout.Label("IP: ");
            IP = GUILayout.TextField(IP);

            GUILayout.Label("Room Size");
            int.TryParse(GUILayout.TextField(RoomSize.ToString()), out RoomSize);
            #endregion

            //Below = important!
            if (GUILayout.Button("Host"))
            {
                //Hosting with a room size of RoomSize
                ClientManager.HostGame(RoomSize);
            }
            if (GUILayout.Button("Connect"))
            {
                //Connecting to the server with ip address 'IP'
                ClientManager.ConnectGame(IP);
            }
            GUILayout.EndVertical();
        }
예제 #2
0
        public static int GetStateHash()
        {
            int hash = LSUtility.PeekRandom(int.MaxValue);

            hash += 1;
            hash ^= AgentController.GetStateHash();
            hash += 1;
            hash ^= ProjectileManager.GetStateHash();
            hash += 1;
            return(hash);
        }