Пример #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Lifes")
        {
            SoundsManager.PlayLifeSound();
            GameManager.AddHealth();
            Destroy(collision.gameObject);
        }

        if (collision.tag == "Key1")
        {
            SoundsManager.PlayDoorSound();
            Destroy(collision.gameObject);
            Key1Canvas.SetActive(true);
            Destroy(Door1);
        }

        if (collision.tag == "Key2")
        {
            SoundsManager.PlayDoorSound();
            Destroy(collision.gameObject);
            Key2Canvas.SetActive(true);
            Destroy(Door2);
        }

        if (collision.tag == "EnemyBullet")
        {
            GameManager.TakeDamage();
            Destroy(collision.gameObject);
        }

        if (collision.tag == "AttackBoost")
        {
            SoundsManager.PlayBoostSound();
            GameManager.AddAttack();
            AttackBoost1Canvas.SetActive(true);
            Destroy(collision.gameObject);
        }

        if (collision.tag == "AttackBoost2")
        {
            SoundsManager.PlayBoostSound();
            GameManager.AddAttack();
            AttackBoost2Canvas.SetActive(true);
            Destroy(collision.gameObject);
        }

        if (collision.tag == "BossAggroZone")
        {
            SoundsManager.PlayDoorSound();
            BossManager.PlayerInRange = true;
        }
    }