private void DamageCharacters(float deltaTime) { if (size.X <= 0.0f) { return; } for (int i = 0; i < Character.CharacterList.Count; i++) { Character c = Character.CharacterList[i]; if (c.AnimController.CurrentHull == null || c.IsDead) { continue; } if (!IsInDamageRange(c, DamageRange)) { continue; } float dmg = (float)Math.Sqrt(size.X) * deltaTime / c.AnimController.Limbs.Length; foreach (Limb limb in c.AnimController.Limbs) { c.LastDamageSource = null; c.DamageLimb(WorldPosition, limb, new List <Affliction>() { AfflictionPrefab.Burn.Instantiate(dmg) }, 0.0f, false, 0.0f); } c.ApplyStatusEffects(ActionType.OnFire, deltaTime); } }
private void DamageCharacters(float deltaTime) { if (size.X <= 0.0f) { return; } for (int i = 0; i < Character.CharacterList.Count; i++) { Character c = Character.CharacterList[i]; if (c.CurrentHull == null || c.IsDead) { continue; } if (!IsInDamageRange(c, DamageRange)) { continue; } //GetApproximateDistance returns float.MaxValue if there's no path through open gaps between the hulls (e.g. if there's a door/wall in between) if (hull.GetApproximateDistance(Position, c.Position, c.CurrentHull, 10000.0f) > size.X + DamageRange) { return; } float dmg = (float)Math.Sqrt(Math.Min(500, size.X)) * deltaTime / c.AnimController.Limbs.Count(l => !l.IsSevered); foreach (Limb limb in c.AnimController.Limbs) { if (limb.IsSevered) { continue; } c.LastDamageSource = null; c.DamageLimb(WorldPosition, limb, AfflictionPrefab.Burn.Instantiate(dmg).ToEnumerable(), 0.0f, false, 0.0f); } #if CLIENT //let clients display the client-side damage immediately, otherwise they may not be able to react to the damage fast enough c.CharacterHealth.DisplayedVitality = c.Vitality; #endif c.ApplyStatusEffects(ActionType.OnFire, deltaTime); } }