Ejemplo n.º 1
0
        private IEnumerator CoWaitForVikingsLeaving()
        {
            if (VikingController.Instance != null)
            {
                VikingController.Instance.CanSpawn = false;
                VikingController.Instance.LeaveAllVikings();

                while (VikingController.Instance.VikingCount > 0)
                {
                    yield return(null);
                }
            }

            DisableGamePlay();
            isRoundActive = false;

            if (Tavern.Instance != null && Tavern.Instance.Money < RequiredMoney)
            {
                TavernBankrupt();
                Debug.Log($"Required money goal was not reached. ({Tavern.Instance.Money}/{RequiredMoney})");
            }
            else
            {
                OnRoundOver?.Invoke();
                ShowScoreCard();
            }
        }
    private void GameManager_OnGameStateChange(EGameStates GameState)
    {
        switch (GameState)
        {
        case EGameStates.MAIN_MENU:
            OnMainMenu?.Invoke();
            break;

        case EGameStates.CONNECTING:
            break;

        case EGameStates.RELOADING_ROUND:
            break;

        case EGameStates.LOADING_NEXTROUND:
            OnRoundBegin.Invoke();
            break;

        case EGameStates.LOADING_REMATCH:
            break;

        case EGameStates.GAMEPLAY:
            OnGameplayBegin?.Invoke();
            break;

        case EGameStates.ROUND_OVER:
            OnRoundOver.Invoke();
            break;

        case EGameStates.GAME_OVER:
            OnGameOver.Invoke();
            break;
        }
    }
Ejemplo n.º 3
0
        public void SetRoundOver(ERoundWinCondition Reason)
        {
            if (Reason != RoundWinCondition)
            {
                return;
            }

            ChangeGameState(EGameStates.ROUND_OVER);
            OnRoundOver.Invoke();
        }
Ejemplo n.º 4
0
        private void ScanRoundOver(RoundOverScan roundOverScan)
        {
            if (OnRoundOver != null)
            {
                const int startX = 464;
                const int length = 100;
                const int y      = 105;

                bool isOver = false;

                // Check for the KOTH round over animation.
                Parallel.For(startX, startX + length, (x, loop) =>
                {
                    if (Capture.CompareTo(new Point(x, y), Markups.KOTH_ROUND_OVER, new int[] { 190, 185, 188 }, 70, 90))
                    {
                        isOver = true;
                        loop.Break();
                    }
                });

                // Check for the elimination round over animation.
                // Team wins
                if (!isOver)
                {
                    isOver = Capture.CompareTo(Points.LOBBY_ELIMINATION_ROUND_OVER, Markups.ELIM_ROUND_OVER, 30, 95, DBCompareFlags.IgnoreBlack);
                }

                // Draw
                if (!isOver)
                {
                    isOver = Capture.CompareTo(Points.LOBBY_ELIMINATION_ROUND_OVER_DRAW, Markups.ELIM_ROUND_OVER_DRAW, 30, 95, DBCompareFlags.IgnoreBlack);
                }

                if (isOver && !roundOverScan.Executed)
                {
                    OnRoundOver.Invoke(this, new EventArgs());
                    roundOverScan.Executed = true;
                }
                else if (!isOver && roundOverScan.Executed)
                {
                    roundOverScan.Executed = false;
                }
            }
        }
Ejemplo n.º 5
0
    public void ChangeGameState(EGameStates NewGameState)
    {
        gameState = NewGameState;
        CustomEvent.Trigger(gameObject, "_OnGamestateChange", NewGameState);

        OnGamestateChange?.Invoke(NewGameState);
        switch (gameState)
        {
        case EGameStates.GameBegin:
            OnGameBegin?.Invoke();

            break;

        case EGameStates.MainMenu:
            OnGameOver?.Invoke();

            break;

        case EGameStates.RoundOver:
            OnRoundOver?.Invoke();

            break;
        }
    }
Ejemplo n.º 6
0
 public void SetRoundOver()
 {
     ChangeGameState(EGameStates.ROUND_OVER);
     OnRoundOver.Invoke();
 }
Ejemplo n.º 7
0
 void GameOver(HeroController controller, bool isSomebodyWon)
 {
     IntroStarted();
     if (isSomebodyWon)
     {
         m_GameUI.StopClock();
         if (ReferenceEquals(controller, playerController))
         {
             Debug.Log("AI wins");
             aiPoints++;
             OnRoundOver?.Invoke(1, currentRound, 1);
         }
         else
         {
             Debug.Log("Player wins");
             playerPoints++;
             OnRoundOver?.Invoke(0, currentRound, -1);
         }
     }
     else
     {
         Debug.Log("Draw");
         OnRoundOver?.Invoke(0, currentRound, 0);
     }
     currentRound++;
     if (currentRound < amountOfRound)
     {
         RestoreGame();
     }
     else
     {
         playerController.RestoreStartState();
         AIController.RestoreStartState();
         OnGameOver?.Invoke();
         m_MenuFSM.LockChangeState();
         if (playerPoints > aiPoints)
         {
             if (playerController.HeroName == HeroesNames.StarlightGlimmer && AIController.HeroName == HeroesNames.TwilightSparkle)
             {
                 m_GameUI.ShowAchievement(0);
             }
             if (playerController.HeroName == HeroesNames.TwilightSparkle && AIController.HeroName == HeroesNames.TwilightSparkle)
             {
                 m_GameUI.ShowAchievement(2);
             }
             if (playerController.HeroName == HeroesNames.Fluttershy && (AIController.HeroName == HeroesNames.PinkiePie || AIController.HeroName == HeroesNames.Rarity))
             {
                 m_GameUI.ShowAchievement(3);
             }
             GameUser.wins++;
             GameConsole.AddMessage("Player wins");
             m_Announcement.PlayHeroWin(playerController.HeroName);
             m_GameUI.ShowGameResult($"{GameLanguages.GetCurrentLocalization(playerController.HeroName.ToString())} {GameLanguages.GetCurrentLocalization("WinText")}");
         }
         else if (playerPoints < aiPoints)
         {
             GameConsole.AddMessage("AI wins");
             GameUser.loses++;
             m_Announcement.PlayHeroWin(AIController.HeroName);
             m_GameUI.ShowGameResult($"{GameLanguages.GetCurrentLocalization(AIController.HeroName.ToString())} {GameLanguages.GetCurrentLocalization("WinText")}");
         }
         else
         {
             GameConsole.AddMessage("Draw");
             GameUser.draws++;
             m_GameUI.ShowGameResult($"{GameLanguages.GetCurrentLocalization("DrawText")}");
         }
     }
 }