Exemple #1
0
    private void Update()
    {
        // When exp bar is filled, level up is activated
        if (m_MainUI.m_XpBar.value >= 1)
        {
            m_MainUI.m_LevelUpButton.gameObject.SetActive(true);
        }

        // THIS IS WHERE THE PLAYER DIES
        if (Instance.m_MainUI.m_HealthBar.value <= 0)
        {
            if (!m_PlayerDied)
            {
                m_PlayerDied = true;
                m_Player.m_Animator.SetTrigger("Death");

                m_MainUI.DeactivateUI();
                StartCoroutine(DeathDelay());
            }
        }


#if UNITY_CHEATS
        if (Input.GetKeyDown(KeyCode.C))
        {
            m_CheatsActivated = !m_CheatsActivated;
            m_CheatCanvas.SetActive(m_CheatsActivated);
        }

        if (m_CheatsActivated)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                LevelUp();
            }
            if (Input.GetKeyDown(KeyCode.H))
            {
                if (!m_HPCheat)
                {
                    m_InfiniteHPText.text = "ON";
                    m_HPCheat             = !m_HPCheat;
                }
                else if (m_HPCheat)
                {
                    m_InfiniteHPText.text = "OFF";
                    m_HPCheat             = !m_HPCheat;
                }
            }
            if (Input.GetKeyDown(KeyCode.J))
            {
                if (!m_AbilityCheat)
                {
                    m_InfiniteAbilitiesText.text = "ON";
                    m_AbilityCheat = !m_AbilityCheat;
                }
                else if (m_AbilityCheat)
                {
                    m_InfiniteAbilitiesText.text = "OFF";
                    m_AbilityCheat = !m_AbilityCheat;
                }
            }
            if (Input.GetKeyDown(KeyCode.M))
            {
                if (!m_MoveCheat)
                {
                    m_InfiniteMoveText.text = "ON";
                    m_MoveCheat             = !m_MoveCheat;
                }
                else if (m_MoveCheat)
                {
                    m_InfiniteMoveText.text = "OFF";
                    m_MoveCheat             = !m_MoveCheat;
                }
            }
            if (Input.GetKeyDown(KeyCode.L))
            {
                if (!m_AttackCheat)
                {
                    m_InfiniteAttacksText.text = "ON";
                    m_AttackCheat = !m_AttackCheat;
                }
                else if (m_AttackCheat)
                {
                    m_InfiniteAttacksText.text = "OFF";
                    m_AttackCheat = !m_AttackCheat;
                }
            }
        }
#endif
    }