Пример #1
0
    public override void init()
    {
        base.init();

        _inputProcessing = new CProcessInput();

        _tutorialSeen = CLocalData.inst().getBoolValue("tutorial_seen", false);

        createLines();

        setState(STATE_INTRO);
    }
Пример #2
0
    public override void update()
    {
        base.update();

        if (mState == STATE_INTRO)
        {
            // No intro for now.

            if (_endedIntro)
            {
                setState(STATE_MENU);
            }
        }
        else if (mState == STATE_MENU)
        {
            //presionar cualquier tecla

            if (Input.GetKeyDown(KeyCode.T))
            {
                tutorialEnabled = true;

                _intro.gameObject.SetActive(false);
                setState(STATE_PLAYING);
            }
            else if (Input.anyKeyDown)
            {
                if (!_tutorialSeen)
                {
                    tutorialEnabled = true;
                }

                _intro.gameObject.SetActive(false);
                setState(STATE_PLAYING);
            }
        }
        else if (mState == STATE_PLAYING)
        {
            if (tutorialEnabled)
            {
                int enemyCount = CEnemyManager.Inst._enemyDeaths;

                if (mCurrentTutorialStage == 1)
                {
                    if (enemyCount >= 3)
                    {
                        mCurrentTutorialStage = 2;

                        CTutorial.Inst.SetState(CTutorial._STATE_NOSFERATU_TEXT);

                        CEnemyManager.Inst.resetEnemyCounter(-CEnemyManager.Inst.cantEnemies());
                    }
                }
                else if (mCurrentTutorialStage == 2)
                {
                    if (enemyCount >= 3)
                    {
                        mCurrentTutorialStage = 3;

                        CTutorial.Inst.SetState(CTutorial._STATE_ZOMBIEBOY_TEXT);

                        CEnemyManager.Inst.resetEnemyCounter(-CEnemyManager.Inst.cantEnemies());
                    }
                }
                else if (mCurrentTutorialStage == 3)
                {
                    if (enemyCount >= 3)
                    {
                        CTutorial.Inst.SetState(CTutorial._STATE_TEXT_DISABLED);

                        tutorialEnabled = false;

                        CLocalData.inst().setBoolValue("tutorial_seen", true);
                        _tutorialSeen = true;

                        setState(STATE_PLAYING);
                        return;
                    }
                }
            }

            // Check controllers
            checkControllerInput();

            if (!CAudioManager.Inst.isMusicPlaying())
            {
                setState(STATE_ENDING);
            }
        }
        else if (mState == STATE_ENDING)
        {
            if (_canExit)
            {
                if (Input.GetKeyDown(KeyCode.R))
                {
                    SceneManager.LoadScene("SampleScene");
                }

                if (Input.GetKeyDown(KeyCode.Escape))
                {
                    Application.Quit();
                }
            }
        }
    }