Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     player       = GameObject.FindGameObjectWithTag("Player");
     playerHealth = player.GetComponent <PlayerHealth>();
     priestHealth = GetComponent <PriestHealth>();
     anim         = GetComponent <Animator>();
 }
Beispiel #2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Enemy")
     {
         priest = (PriestHealth)other.gameObject.GetComponent <PriestHealth>();
         priest.Death();
     }
 }
Beispiel #3
0
    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);
        }
    }