Exemple #1
0
        private void UpdateServerStartButton()
        {
            int[] teams = TeamTracker.GetInstance().GetTeams();
            if (teams[0] == 0 || teams[1] == 0)
            {
                startGameButtonText.text = "Waiting for teams";
                allowServerStart         = false;
                return;
            }

            bool allReady = true;

            foreach (GameObject player in PlayerTracker.GetInstance().GetPlayers())
            {
                if (!player)
                {
                    continue;
                }
                PlayerDataForClients settings = player.GetComponent <PlayerDataForClients>();
                if (!settings.GetIsReadyFlag() && !settings.GetIsServerFlag())
                {
                    allReady = false;
                }
            }

            startGameButtonText.text = allReady ? "Start game" : "Waiting on ready";
            allowServerStart         = allReady;
        }
Exemple #2
0
        // on start instead of awake to make sure it happens afterwards (check if better way)
        public void Start()
        {
            foreach (GameObject player in PlayerTracker.GetInstance().GetPlayers())
            {
                NewLobbyPlayerAdded(player);
            }
            PlayerTracker.GetInstance().OnPlayerAdded   += NewLobbyPlayerAdded;
            PlayerTracker.GetInstance().OnPlayerRemoved += OldLobbyPlayerRemoved;

            TeamTracker.GetInstance().OnTeamChanged += UpdateVersusText;
            TeamTracker.GetInstance().ForceRecount();
        }