Esempio n. 1
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Enemy")
     {
         CharachterState state = collision.gameObject.GetComponentInParent <CharachterState>();
         state.hp -= damage;
         Destroy(gameObject);
     }
 }
Esempio n. 2
0
File: Enemy.cs Progetto: uchr/LD45
    private void OnCollisionStay(Collision collision)
    {
        if (timer > 0.0f)
        {
            return;
        }

        if (collision.gameObject.tag == "Player")
        {
            CharachterState state = collision.gameObject.GetComponentInParent <CharachterState>();
            cachedAnimatorController.SetTrigger("Attack");
            state.hp -= damage;
            timer     = attackTime;
        }
    }