private void FireDoubleInternal(float x, float y, float angle) // :) { Sound.Play("thump"); var rpg = new TimedMine(TimeSpan.FromSeconds(2)) { Silent = true }; rpg.MoveTo(x, y); var rpgSpeed = new SpeedTracker(rpg); rpgSpeed.HitDetectionTypes.Add(typeof(Wall)); rpgSpeed.HitDetectionTypes.Add(typeof(Character)); rpgSpeed.HitDetectionExclusions.Add(Holder); rpgSpeed.ImpactOccurred.SubscribeForLifetime((impact) => { if (impact.ElementHit is IDestructible) { var destructible = impact.ElementHit as IDestructible; destructible.TakeDamage(5 * rpg.HealthPointsPerShrapnel); } rpg.Explode(); }, rpg.Lifetime); new Force(rpgSpeed, SpaceExtensions.NormalizeQuantity(25, angle), angle); SpaceTime.CurrentSpaceTime.Add(rpg); }
private void FireDoubleInternal(float x, float y, float angle) // :) { var rpg = new TimedMine(this, TimeSpan.FromSeconds(2)) { Silent = true, ProjectilePen = ProjectilePen }; rpg.MoveTo(x, y, Holder.ZIndex); var rpgSpeed = new SpeedTracker(rpg); rpgSpeed.HitDetectionExclusions.Add(Holder); Holder.Speed.HitDetectionExclusions.Add(rpg); rpgSpeed.ImpactOccurred.SubscribeForLifetime((impact) => { DamageBroker.Instance.ReportImpact(impact); rpg.Explode(); }, rpg.Lifetime); new Force(rpgSpeed, 45.NormalizeQuantity(angle), angle); SpaceTime.CurrentSpaceTime.Add(rpg); }