Beispiel #1
0
 public void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.tag == "Enemy")
     {
         Destroy(gameObject);
         GameObject     Target         = collider.gameObject;
         HealthManageer healthManageer = Target.GetComponent <HealthManageer>();
         healthManageer.GetDamage(damage);
     }
 }
Beispiel #2
0
 public void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.tag == "Enemy")
     {
         anim.SetBool("HasToCollide", true);
         GameObject     Target         = collider.gameObject;
         HealthManageer healthManageer = Target.GetComponent <HealthManageer>();
         healthManageer.GetDamage(damage);
     }
 }
Beispiel #3
0
 public void DealDamage(float damage)
 {
     if (Target)
     {
         HealthManageer healthManageer = Target.GetComponent <HealthManageer>();
         if (healthManageer.health > 0)
         {
             healthManageer.GetDamage(damage);
         }
         else
         {
             anim.SetBool("HasToAttack", false);
         }
     }
 }
Beispiel #4
0
    public void Fire()
    {
        Debug.Log("fire");
        GameObject Bullet = Instantiate(projectile) as GameObject;

        Bullet.transform.parent   = projectileParent.transform;
        Bullet.transform.position = firePoint.transform.position;
        if (Target)
        {
            HealthManageer healthManageer = Target.GetComponent <HealthManageer>();
            if (healthManageer.health < 0)
            {
                anim.SetBool("HasToAttack", false);
            }
        }
    }
Beispiel #5
0
 public void DealDamage(float damage)
 {
     if (Target)
     {
         healthManageer = Target.GetComponent <HealthManageer>();
         if (healthManageer.health > 0)
         {
             if (Target.tag == "Hero")
             {
                 healthManageer.GetDamage(damage);
             }
         }
         else
         {
             anim.SetBool("HasToAttackNNoWalk", false);
             anim.SetBool("HasToWalk", true);
         }
     }
 }