Пример #1
0
        void GivePayOut()
        {
            if (m_payout <= 0)
            {
                CancelInvoke("GivePayOut");
                StartCoroutine(Delay());

                return;
            }

            --m_payout;
            m_payOutScore.SetScores(m_payout);
            ++m_coins;
            m_credit.SetScores(m_coins);

            if (PC_InputManager.IsConfirmInputPressedDown() || m_credit.m_scoreValue == PC_GameSetup.Casino.COIN_LIMIT)
            {
                m_coins += m_payout;
                m_credit.SetScores(m_coins);

                CancelInvoke("GivePayOut");
                StartCoroutine(Delay());

                return;
            }
            InvokeRepeating("GivePayOut", 0, 1.0f);
        }
Пример #2
0
        // Update is called once per frame
        protected override void Update()
        {
            if (m_credit.m_scoreValue >= PC_GameSetup.Casino.COIN_LIMIT)
            {
                Debug.LogWarning("You've got 99,999 Coins.");
                EndGame();
            }
            else if (m_coins <= 0)
            {
                Debug.LogError("GAME OVER");
                EndGame();
            }
            else if (m_gameRunning) // Reels are spinning
            {
                bool stop = false;

                if (PC_InputManager.IsConfirmInputPressedDown())
                {
                    PC_AudioManager.PlaySE(m_slotStop);

                    if (m_reels[0].IsSpinning)
                    {
                        m_reels[0].StopSpinning(m_replay);
                        m_buttons[0].SetActive(true);
                    }
                    else if (m_reels[1].IsSpinning)
                    {
                        m_reels[1].StopSpinning(m_replay);
                        m_buttons[1].SetActive(true);
                    }
                    else if (m_reels[2].IsSpinning)
                    {
                        m_reels[2].StopSpinning(m_replay);
                        m_buttons[2].SetActive(true);
                        stop = true;
                    }
                }

                if (stop)
                {
                    m_gameRunning = false;
                    m_gameEnded   = true;
                    Payout();
                }
            }
            else if (m_gameEnded && m_panel.m_lose)
            {
                StartCoroutine(Delay(2f));
                if (PC_InputManager.IsConfirmInputPressedDown())
                {
                    ResetLines();
                }
            }
            else if (!m_gameEnded && m_panel.m_lose)
            {
                ResetLines();
                return;
            }
            else if (m_needToPay)
            {
                return;
            }
            else // Awaiting coins for the next spin
            {
                if (m_wager < 3 && m_coins > 0 && PC_InputManager.IsWagerInputPressed())
                {
                    PC_AudioManager.PlaySE(m_slotCoin);

                    if (m_wager == 0)
                    {
                        PC_EventManager.TriggerEvent(PC_EventSetup.SlotMachine.PLAY_ANIMATION, PC_GameSetup.SlotMachine.PRESS);//m_panel.PlayAnimation(PC_GameSetup.SlotMachine.PRESS);
                    }
                    ++m_wager;
                    --m_coins;
                    m_credit.SetScores(m_coins);

                    if (m_wager >= 3)
                    {
                        m_lines[4].SetActive(true);
                        m_lines[3].SetActive(true);
                    }
                    else if (m_wager >= 2)
                    {
                        m_lines[2].SetActive(true);
                        m_lines[1].SetActive(true);
                    }
                    if (m_wager >= 1)
                    {
                        m_lines[0].SetActive(true);
                    }
                }
                else if (m_wager >= 3 || (m_wager > 0 && m_coins == 0) || (PC_InputManager.IsConfirmInputPressedDown() && m_wager > 0) || m_replay)
                {
                    if (m_replay)
                    {
                        m_wager = 3;
                        foreach (GameObject ln in m_lines)
                        {
                            ln.SetActive(true);
                        }
                    }

                    m_gameRunning = true;

                    PC_EventManager.TriggerEvent(PC_EventSetup.SlotMachine.PLAY_ANIMATION, PC_GameSetup.SlotMachine.STOP);
                    //m_panel.PlayAnimation(PC_GameSetup.SlotMachine.STOP);

                    foreach (PC_SlotMachineReel reel in m_reels)
                    {
                        reel.StartSpinning();
                    }
                }

                if (PC_InputManager.IsCancelInputPressed() && m_wager == 0)
                {
                    //GO OUT
                    Debug.Log("EXIT GAME");
                    GoBackToCasino();
                }
            }
        }