Ejemplo n.º 1
0
    void Update()
    {
        var rnd  = new System.Random();
        var tick = rnd.Next(1, 6);

        m_MyGameObject = GameObject.Find("Exorcist");

        // Press the space key to add the Scene additively and move the GameObject to that Scene
        if (previous)
        {
            if (tick == 1)
            {
                Debug.Log("playerHealthDebuff");
                if (m_MyGameObject.GetComponent <ExorcistController>().currentHealth < 1)
                {
                    BuffManager.playerHealthDebuff = true;
                    BuffDebuff.UpdateText("Player Health Debuff");
                }
                else
                {
                    tick = 2;
                }
            }
            if (tick == 2)
            {
                Debug.Log("playerMovementDebuff");
                if (!BuffManager.playerMovementDebuff)
                {
                    BuffManager.playerMovementDebuff = true;
                    BuffDebuff.UpdateText("Player Movement Debuff");
                }
                else
                {
                    tick = 3;
                }
            }
            if (tick == 3)
            {
                Debug.Log("monsterMovementBuff");
                if (!BuffManager.monsterMovementBuff)
                {
                    BuffManager.monsterMovementBuff = true;
                    BuffDebuff.UpdateText("Monster Movement Buff");
                }
                else
                {
                    tick = 4;
                }
            }
            if (tick == 4)
            {
                Debug.Log("highscoredebuff");
                if (!BuffManager.highScoreDebuff)
                {
                    BuffManager.highScoreDebuff = true;
                    BuffDebuff.UpdateText("High Score Debuff");
                }
                else
                {
                    tick = 4;
                }
            }
            if (tick == 5)
            {
                Debug.Log("visibility");
                if (!BuffManager.visibilityDebuff)
                {
                    BuffManager.visibilityDebuff = true;
                    BuffDebuff.UpdateText("Player Visibility Debuff");
                }
                else
                {
                    BuffManager.debuffCounter += 1;
                }
            }
            previous = false;
            m_Scene  = previousScene;
            StartCoroutine(LoadYourAsyncScene());
        }
        else if (next)
        {
            next    = false;
            m_Scene = nextScene;
            StartCoroutine(LoadYourAsyncScene());
        }
    }
Ejemplo n.º 2
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Enemy")
        {
            AudioSource.PlayClipAtPoint(exorcistDamagedAudio, transform.position);
            currentHealth--;
        }

        if (collision.gameObject.tag == "Item")
        {
            HighScore.score += 50;
            Destroy(collision.gameObject);
            var rnd  = new System.Random();
            var tick = rnd.Next(1, 5);
            if (tick == 1)
            {
                Debug.Log("healthBuff");
                if (currentHealth < 5)
                {
                    BuffManager.healthBuff = true;
                    BuffDebuff.UpdateText("Player Health Buff");
                }
                else
                {
                    tick = 2;
                }
            }
            if (tick == 2)
            {
                Debug.Log("movementBuff");

                if (!BuffManager.movementBuff)
                {
                    BuffManager.movementBuff = true;
                    BuffDebuff.UpdateText("Player Movement Buff");
                }
                else
                {
                    tick = 3;
                }
            }
            if (tick == 3)
            {
                Debug.Log("highScoreBuff");

                if (!BuffManager.highScoreBuff)
                {
                    BuffManager.highScoreBuff = true;
                    BuffDebuff.UpdateText("High Score Buff");
                }
                else
                {
                    tick = 4;
                }
            }
            if (tick == 4)
            {
                Debug.Log("fireRateBuff");

                if (!BuffManager.fireRateBuff)
                {
                    BuffManager.fireRateBuff = true;
                    BuffDebuff.UpdateText("Player Fire Rate Buff");
                }
                else
                {
                    BuffManager.buffCounter += 1;
                }
            }
        }

        if (collision.gameObject.tag == "ShovelProjectile")
        {
            Destroy(collision.gameObject);
            currentHealth--;
        }
    }