예제 #1
0
        private IEnumerator StartNewRound()
        {
            Debug.Log("New round setup");

            IsRoundOver = true;
            //We stop coroutines of the spawn system in order to not respawn players when a round is over
            PlayerSpawnSystem.Instance.StopAllCoroutines();

            yield return(new WaitForSeconds(2));


            RemainingTimeBeforeNextRound = MatchSettings.TimeBetweenRounds;

            while (RemainingTimeBeforeNextRound > 0)
            {
                NewRoundLaunched?.Invoke(this, new NewRoundLaunchedEventArgs {
                    RemainingTimeBeforeNextRound = RemainingTimeBeforeNextRound
                });

                yield return(new WaitForSeconds(1));

                RemainingTimeBeforeNextRound--;
            }

            NewRoundStarted?.Invoke(this, EventArgs.Empty);

            PlayerSpawnSystem.Instance.SpawnAllPlayers(0);

            IsRoundOver = false;
            currentRound++;

            Debug.Log("Round " + currentRound + " started !");
        }
예제 #2
0
        public async void EndRound()
        {
            HUDVisibility = Visibility.Hidden;
            if (!IsRoundEnded)
            {
                IsRoundEnded = true;
                GameEndPayload payload = GetGameResult();
                SaveLoader.Save.SelectedProfile.Money += payload.EarnedMoney;
                GameEndModalContent modalContent = new GameEndModalContent(payload);
                var result = await OverlaySettings.OpenedModals.OpenModal(new Modal <GameEndUserDecision>(modalContent));

                switch (result.Payload)
                {
                case GameEndUserDecision.BackToMenu:
                    Router.ChangeCurrentPage(new MinigameSelectionPage());
                    break;

                case GameEndUserDecision.NewRound:
                    NewRoundStarted?.Invoke();
                    break;

                default:
                    break;
                }
            }
        }