Esempio n. 1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (!col.gameObject.CompareTag("Projectile"))
        {
            return;
        }

        ProjectileBehaviour projectile = col.GetComponent <ProjectileBehaviour>();

        current_life -= projectile.Damage;

        //TODO: animate enemy taken damage
        GameObject.Destroy(col.gameObject);

        if (current_life <= 0)
        {
            _player.AddGold(_value);
            GameObject.Destroy(this.gameObject);
        }
    }