Ejemplo n.º 1
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag.Equals("Ice"))
        {
            if (_velocity > MinVelocity)
            {
                Debug.Log("I got froze!");
                StartCoroutine(Freezing());
                _velocity *= 0.5f;
            }
            else
            {
                _velocity = MinVelocity;
            }
        }
        else if (collision.gameObject.tag.Equals("Flame"))
        {
            enemyHP -= 0.2f;
        }
        else
        {
            enemyHP--;
            Debug.Log("I got hit!");
        }

        if (enemyHP <= 0f)
        {
            Enemies.Destroy(Parameters.EnemyId);

            Destroy(gameObject);
        }
    }