예제 #1
0
    public void OnCollisionEnter2D(Collision2D collision)
    {
        // Give damage
        BatController giveDamage = collision.collider.GetComponent <BatController>();

        //BatController giveDamage = player.GetComponent<BatController>();
        giveDamage.takedamage(enemyDamage);
    }
예제 #2
0
    public void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player"))   //dont want to attack particles please :)
        // Attack animation

        //Debug.Log(other);

        // Give damage
        {
            BatController giveDamage = other.gameObject.GetComponent <BatController>();
            //BatController giveDamage = player.GetComponent<BatController>();

            GetComponent <Animator>().Play("snake bite");

            giveDamage.takedamage(enemyDamage);
        }
    }