public void OnCollisionEnter2D(Collision2D collision) { // Give damage BatController giveDamage = collision.collider.GetComponent <BatController>(); //BatController giveDamage = player.GetComponent<BatController>(); giveDamage.takedamage(enemyDamage); }
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); } }