Exemple #1
0
        public void ShowResult(bool won, int amount, Action done)
        {
            MessageScreen screen = null;

            if (won)
            {
                m_globalUI.RemoveOverlay();

                screen = Instantiate(m_victoryScreen);
                m_globalUI.Open(screen);

                screen.Init("Congratulations! You have won Rs. " + amount + ".", false, true, () =>
                {
                    m_globalUI.CloseLastScreen();
                });

                if (Random.Range(0, 10) < 3)
                {
                    m_hostView.Express(Expression.BLINK);
                }
                else
                {
                    m_hostView.Express(Expression.SMILE);
                }
            }
            else
            {
                m_globalUI.RemoveOverlay();

                screen = Instantiate(m_lostScreen);
                m_globalUI.Open(screen);

                screen.Init("You lost Rs. " + amount + ".\n Try next time.", false, true, () =>
                {
                    m_globalUI.CloseLastScreen();
                });

                if (Random.Range(0, 10) < 3)
                {
                    m_hostView.Express(Expression.SHOCK);
                }
                else
                {
                    m_hostView.Express(Expression.CRY);
                }
            }

            if (won)
            {
                AudioManager.Instance.PlayOneShot(AudioManager.Instance.GetClipFromPlaylist(CheersAudio), Vector3.zero, .4f);
            }

            m_globalUI.Overlay(screen.transform);
            m_hostView.CollectDice(done);
            m_globalUI.UpdateCoins(won ? amount : -amount);

            if (won)
            {
                m_player.RoundsWon += 1;
            }
            m_player.RoundsPlayed += 1;
            PlayerPrefs.SetInt(Lucky7.RoundsCount, PlayerPrefs.GetInt(Lucky7.RoundsCount, 0) + 1);
            PlayerPrefs.SetInt(Lucky7.WinCount, PlayerPrefs.GetInt(Lucky7.WinCount, 0) + 1);
        }