示例#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);
     }
 }
示例#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);
     }
 }
示例#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);
         }
     }
 }
示例#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);
            }
        }
    }
示例#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);
         }
     }
 }