public void Blast() { blast.Play(); Collider[] hits = Physics.OverlapBox(transform.position, overlapExtents); Debug.Log(hits.Length); foreach (Collider hit in hits) { HealthManager health = hit.GetComponent <HealthManager>(); if (health) { health.Attack(10.0f, "Blast"); } } }
/* * override of base class * attacks in front of user, if object hit has a HealthManager component, causes damage */ public override void UseEquipment() { RaycastHit hit; if (Physics.Raycast(transform.position, transform.forward, out hit, knifeRange)) { GameObject target = hit.collider.gameObject; HealthManager targetHealth = target.GetComponent <HealthManager> (); if (targetHealth) { targetHealth.Attack(damage); } } }
IEnumerator Shock() { yield return(new WaitForSeconds(1.0f)); particles.Play(); while (numConditionsMet == 2) { Collider[] hits = Physics.OverlapBox(transform.position, overlapExtents); foreach (Collider hit in hits) { HealthManager health = hit.GetComponent <HealthManager>(); if (health) { health.Attack(0.5f, "Shock"); } } yield return(new WaitForSeconds(0.5f)); } particles.Stop(); yield break; }
IEnumerator Thrust(float time) { float startTime = Time.time; float currTime = Time.time; while (currTime - startTime < time) { Collider[] hits = Physics.OverlapBox(transform.position, overlapExtents); foreach (Collider hit in hits) { HealthManager health = hit.GetComponent <HealthManager>(); if (health) { health.Attack(1.0f, "Thrust"); } } currTime = Time.time; yield return(new WaitForSeconds(0.5f)); } yield break; }