Exemplo n.º 1
0
        public override void OnGameMessage(GameMessage message)
        {
            UpdateTeamRoster updateTeams = message as UpdateTeamRoster;

            if (updateTeams != null)
            {
                if (clientManager.OnUpdateTeamRoster != null)
                {
                    clientManager.OnUpdateTeamRoster(updateTeams.RedTeam, updateTeams.BlueTeam);
                }
                return;
            }

            MatchCountdownStarted countdownStarted = message as MatchCountdownStarted;

            if (countdownStarted != null)
            {
                if (clientManager.OnMatchCountdownStarted != null)
                {
                    clientManager.OnMatchCountdownStarted(countdownStarted.Delay);
                }
            }

            GamePlayStarted gameStarted = message as GamePlayStarted;

            if (gameStarted != null)
            {
                if (clientManager.LoadPrefabs() && clientManager.Spawn())
                {
                    //clientManager.NetworkManager.PlayerSpawned();
                    clientManager.ChangeState(clientManager.ClientGamePlayState, gameStarted);
                }
            }
        }
Exemplo n.º 2
0
        public void OnGameMessage(GameMessage message)
        {
            RegistrationOnServer registration = message as RegistrationOnServer;

            if (registration != null)
            {
                clientManager.UpdateTeamDetails(registration.Team, registration.TeamOrder);
                return;
            }

            UpdateTeamRoster updateTeams = message as UpdateTeamRoster;

            if (updateTeams != null)
            {
                clientManager.OnUpdateTeamRoster(updateTeams.RedTeam, updateTeams.BlueTeam);
                return;
            }

            ClientReadyToPlay readyToPlay = message as ClientReadyToPlay;

            if (readyToPlay != null)
            {
                clientManager.NetworkManager.ReadyToPlay();
                return;
            }

            EnteredGame enteredGame = message as EnteredGame;

            if (enteredGame != null)
            {
                clientManager.ChangeState(clientManager.ClientGameSetupState);
            }
        }