public void OnTriggerEnter2D(Collider2D collider) { if (collider.tag == "Enemy") { Destroy(gameObject); GameObject Target = collider.gameObject; HealthManageer healthManageer = Target.GetComponent <HealthManageer>(); healthManageer.GetDamage(damage); } }
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); } }
public void DealDamage(float damage) { if (Target) { HealthManageer healthManageer = Target.GetComponent <HealthManageer>(); if (healthManageer.health > 0) { healthManageer.GetDamage(damage); } else { anim.SetBool("HasToAttack", false); } } }
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); } } }
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); } } }