Exemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            Debug.Log("margaya madarchod");
            _health.DamagePlayer();
        }

        if (other.CompareTag("Saber"))
        {
            health--;
            _audio.Hit();
            StartCoroutine(EnableCollider());
            if (health <= 0)
            {
                if (gameObject.CompareTag("EnemyAgile"))
                {
                    _shake.CamShakeKill();
                    _score.PointsOne();
                    Destroy(gameObject);
                }
                else if (gameObject.CompareTag("EnemyNormal"))
                {
                    _shake.CamShakeKill();
                    _score.PointsTwo();
                    Destroy(gameObject);
                }
                else if (gameObject.CompareTag("EnemyHeavy"))
                {
                    _shake.CamShakeKill();
                    _score.PointsThree();
                    Destroy(gameObject);
                }
            }
        }

        if (other.CompareTag("Force"))
        {
            theForce = true;
            _rigidbody2D.velocity = Vector2.zero;
        }
    }