// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent <PlayerHealth>(); priestHealth = GetComponent <PriestHealth>(); anim = GetComponent <Animator>(); }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Enemy") { priest = (PriestHealth)other.gameObject.GetComponent <PriestHealth>(); priest.Death(); } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Boundary") { return; } if (other.tag == "Enemy") { PriestHealth enemy = (PriestHealth)other.gameObject.GetComponent <PriestHealth>(); if (enemy != null) { enemy.TakeDamage(damage); } Destroy(gameObject); } else if (other.tag == "World") { print("impact"); Destroy(gameObject); } }