Example #1
0
    public override void init()
    {
        base.init();

        _inputProcessing = new CProcessInput();

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

        createLines();

        setState(STATE_INTRO);
    }
Example #2
0
    //--------------------------------------------------------------------------------------------------------------------
    // SINGLETON.
    //--------------------------------------------------------------------------------------------------------------------

    /// ------------------------------------------------------------------------------------------------------------------
    /// <summary>
    /// Register the class as a singleton. Called from the constructor.
    /// </summary>
    /// ------------------------------------------------------------------------------------------------------------------
    private void registerSingleton()
    {
        // If the instance (static) is null, it means that this is the first object of this class we created.
        if (mInst == null)
        {
            // Save the reference to be returned by inst().
            mInst = this;
        }
        else
        {
            // If the instance is not null, there is already created a instace of this class. Don't let another.
            throw new UnityException("ERROR: Cannot create another instance of singleton class CLocalData.");
        }
    }
Example #3
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();
                }
            }
        }
    }