protected override void UpdatePhysics() { List <LivingEntity> touched = CollisionUtil.EntitiesInSphere(transform.position, hitRange); if (bounces == 0) { touched.Remove(EntitiesManager.I.player); } foreach (LivingEntity ent in touched) { float lastHitTime; if (lastHitTimes.TryGetValue(ent, out lastHitTime)) { if (lastHitTime + hitCooldown <= Time.time) { lastHitTimes[ent] = Time.time; InflictDamage(ent); } } else { lastHitTimes.Add(ent, Time.time); InflictDamage(ent); } } }
protected override void UpdatePhysics() { List <LivingEntity> touched = CollisionUtil.EntitiesInCone(transform.position, heading, angle, range); touched.Remove(EntitiesManager.I.player); foreach (LivingEntity ent in touched) { InflictDamage(ent); } Die(); }
protected override void UpdatePhysics() { if (creationTime + pauseTime <= Time.time) { system.Pause(); } transform.LookAt(transform.position + heading); if (lastHitTime + hitCooldown <= Time.time) { List <LivingEntity> touched = CollisionUtil.EntitiesInBeam(transform.position, heading, width, maxRange); touched.Remove(EntitiesManager.I.player); if (touched.Count != 0) { lastHitTime = Time.time; Debug.Log("HIT"); foreach (LivingEntity ent in touched) { InflictDamage(ent); } } } }