Beispiel #1
0
 void IntroEnded()
 {
     playerController.IntroEnded();
     AIController.IntroEnded();
     m_Announcement.PlayRoundSound(currentRound);
     m_GameUI.ShowMessage($"{GameLanguages.GetCurrentLocalization("RoundText")} {currentRound + 1}");
     m_GameUI.StartClock(99f);
 }
Beispiel #2
0
 void RestoreGame()
 {
     playerController.RestoreStartState();
     AIController.RestoreStartState();
     StartCoroutine(InterRoundsDelay(0.3f));
     m_Announcement.PlayRoundSound(currentRound);
     m_GameUI.ShowMessage($"{GameLanguages.GetCurrentLocalization("RoundText")} {currentRound + 1}");
     m_GameUI.StartClock(99f);
     m_GameUI.StopClock();
 }
 void RefreshText()
 {
     if (_LocalizationText != "")
     {
         if (_text == null)
         {
             _text = GetComponent <Text>();
         }
         _text.text = GameLanguages.GetCurrentLocalization(_LocalizationText);
     }
 }
Beispiel #4
0
    public static void AddMessage(string input, bool IsUser = false, bool AddTime = true)
    {
        string message = input;

        if (AddTime)
        {
            message = $"[{DateTime.Now.Hour}:{DateTime.Now.Minute}:{DateTime.Now.Second}] {input}";
        }
        messages.Add(message);
        OnNewMessage?.Invoke(message);
        if (IsUser)
        {
            for (int i = 0; i < UserCommands.Length; i++)
            {
                if (input == UserCommands[i])
                {
                    OnUserCommand?.Invoke(input);
                    return;
                }
            }
            AddMessage(GameLanguages.GetCurrentLocalization("ConsoleUnknownCommand"), false, false);
        }
    }
Beispiel #5
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")}");
         }
     }
 }