Exemplo n.º 1
0
        public override void NetworkStart()
        {
            base.NetworkStart();

            if (!IsServer)
            {
                enabled = false;
            }
            else
            {
                m_NetPortal       = GameObject.FindGameObjectWithTag("GameNetPortal").GetComponent <GameNetPortal>();
                m_ServerNetPortal = m_NetPortal.GetComponent <ServerGameNetPortal>();

                m_NetPortal.ClientSceneChanged += OnClientSceneChanged;

                // retrieve the lobby state info so that the players we're about to spawn can query it
                var o = GameStateRelay.GetRelayObject();
                if (o != null && o.GetType() != typeof(LobbyResults))
                {
                    throw new System.Exception("No LobbyResults found!");
                }
                m_LobbyResults = (LobbyResults)o;

                DoInitialSpawnIfPossible();
            }
        }
Exemplo n.º 2
0
        private IEnumerator CoroGameOver(float wait, bool gameWon)
        {
            // wait 5 seconds for game animations to finish
            yield return(new WaitForSeconds(wait));

            GameStateRelay.SetRelayObject(gameWon);
            MLAPI.SceneManagement.NetworkSceneManager.SwitchScene("PostGame");
        }
Exemplo n.º 3
0
        private void SaveLobbyResults()
        {
            LobbyResults lobbyResults = new LobbyResults();

            foreach (CharSelectData.LobbyPlayerState playerInfo in CharSelectData.LobbyPlayers)
            {
                lobbyResults.Choices[playerInfo.ClientId] = new LobbyResults.CharSelectChoice(playerInfo.PlayerNum,
                                                                                              CharSelectData.LobbySeatConfigurations[playerInfo.SeatIdx].Class,
                                                                                              CharSelectData.LobbySeatConfigurations[playerInfo.SeatIdx].CharacterArtIdx);
            }
            GameStateRelay.SetRelayObject(lobbyResults);
        }
Exemplo n.º 4
0
 public override void NetworkStart()
 {
     base.NetworkStart();
     if (!IsServer)
     {
         enabled = false;
     }
     else
     {
         bool won = (bool)GameStateRelay.GetRelayObject();
         StartCoroutine(CoroSetWinLoss(won));
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Temp code to spawn an enemy
 /// </summary>
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.E))
     {
         var newEnemy = Instantiate(m_EnemyPrefab);
         newEnemy.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId);
     }
     if (Input.GetKeyDown(KeyCode.B))
     {
         var newEnemy = Instantiate(m_BossPrefab);
         newEnemy.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId);
     }
     if (Input.GetKeyDown(KeyCode.Q))
     {
         GameStateRelay.SetRelayObject(false);
         MLAPI.SceneManagement.NetworkSceneManager.SwitchScene("PostGame");
     }
 }