public override void Activate(Actor self, Order order, SupportPowerManager manager) { base.Activate(self, order, manager); PlayLaunchSounds(); if (!string.IsNullOrEmpty(info.ActivationSequence)) { var wsb = self.Trait <WithSpriteBody>(); wsb.PlayCustomAnimation(self, info.ActivationSequence, () => wsb.CancelCustomAnimation(self)); } var targetPosition = self.World.Map.CenterOfCell(order.TargetLocation); var palette = info.IsPlayerPalette ? info.MissilePalette + self.Owner.InternalName : info.MissilePalette; var missile = new NukeLaunch(self.Owner, info.MissileWeapon, info.WeaponInfo, palette, info.MissileUp, info.MissileDown, self.CenterPosition + body.LocalToWorld(info.SpawnOffset), targetPosition, info.FlightVelocity, info.FlightDelay, info.SkipAscent, info.FlashType); self.World.AddFrameEndTask(w => w.Add(missile)); if (info.CameraRange != WDist.Zero) { var type = info.RevealGeneratedShroud ? Shroud.SourceType.Visibility : Shroud.SourceType.PassiveVisibility; self.World.AddFrameEndTask(w => w.Add(new RevealShroudEffect(targetPosition, info.CameraRange, type, self.Owner, info.CameraStances, info.FlightDelay - info.CameraSpawnAdvance, info.CameraSpawnAdvance + info.CameraRemoveDelay))); } if (Info.DisplayBeacon) { var beacon = new Beacon( order.Player, targetPosition, Info.BeaconPaletteIsPlayerPalette, Info.BeaconPalette, Info.BeaconImage, Info.BeaconPoster, Info.BeaconPosterPalette, Info.ArrowSequence, Info.CircleSequence, Info.ClockSequence, () => missile.FractionComplete, Info.BeaconDelay, info.FlightDelay - info.BeaconRemoveAdvance); self.World.AddFrameEndTask(w => { w.Add(beacon); }); } }
public void Activate(Actor self, WPos targetPosition) { foreach (var launchpad in self.TraitsImplementing <INotifyNuke>()) { launchpad.Launching(self); } var palette = info.IsPlayerPalette ? info.MissilePalette + self.Owner.InternalName : info.MissilePalette; var skipAscent = info.SkipAscent || body == null; var launchPos = skipAscent ? WPos.Zero : self.CenterPosition + body.LocalToWorld(info.SpawnOffset); var missile = new NukeLaunch(self.Owner, info.MissileWeapon, info.WeaponInfo, palette, info.MissileUp, info.MissileDown, launchPos, targetPosition, info.DetonationAltitude, info.RemoveMissileOnDetonation, info.FlightVelocity, info.MissileDelay, info.FlightDelay, skipAscent, info.FlashType, info.TrailImage, info.TrailSequences, info.TrailPalette, info.TrailUsePlayerPalette, info.TrailDelay, info.TrailInterval); self.World.AddFrameEndTask(w => w.Add(missile)); if (info.CameraRange != WDist.Zero) { var type = info.RevealGeneratedShroud ? Shroud.SourceType.Visibility : Shroud.SourceType.PassiveVisibility; self.World.AddFrameEndTask(w => w.Add(new RevealShroudEffect(targetPosition, info.CameraRange, type, self.Owner, info.CameraStances, info.FlightDelay - info.CameraSpawnAdvance, info.CameraSpawnAdvance + info.CameraRemoveDelay))); } if (Info.DisplayBeacon) { var beacon = new Beacon( self.Owner, targetPosition, Info.BeaconPaletteIsPlayerPalette, Info.BeaconPalette, Info.BeaconImage, Info.BeaconPoster, Info.BeaconPosterPalette, Info.BeaconSequence, Info.ArrowSequence, Info.CircleSequence, Info.ClockSequence, () => missile.FractionComplete, Info.BeaconDelay, info.FlightDelay - info.BeaconRemoveAdvance); self.World.AddFrameEndTask(w => { w.Add(beacon); }); } }
public void Activate(Actor self, WPos targetPosition) { var palette = Info.IsPlayerPalette ? Info.MissilePalette + self.Owner.InternalName : Info.MissilePalette; var skipAscent = Info.SkipAscent || body == null; var launchPos = skipAscent ? WPos.Zero : self.CenterPosition + body.LocalToWorld(Info.SpawnOffset); var missile = new NukeLaunch(self.Owner, Info.MissileWeapon, Info.WeaponInfo, palette, Info.MissileUp, Info.MissileDown, launchPos, targetPosition, Info.DetonationAltitude, Info.RemoveMissileOnDetonation, Info.FlightVelocity, Info.MissileDelay, Info.FlightDelay, skipAscent, Info.TrailImage, Info.TrailSequences, Info.TrailPalette, Info.TrailUsePlayerPalette, Info.TrailDelay, Info.TrailInterval); self.World.AddFrameEndTask(w => w.Add(missile)); if (Info.CameraRange != WDist.Zero) { var type = Info.RevealGeneratedShroud ? Shroud.SourceType.Visibility : Shroud.SourceType.PassiveVisibility; self.World.AddFrameEndTask(w => w.Add(new RevealShroudEffect(targetPosition, Info.CameraRange, type, self.Owner, Info.CameraRelationships, Info.FlightDelay - Info.CameraSpawnAdvance, Info.CameraSpawnAdvance + Info.CameraRemoveDelay))); } if (Info.DisplayBeacon) { var beacon = new Beacon( self.Owner, targetPosition, Info.BeaconPaletteIsPlayerPalette, Info.BeaconPalette, Info.BeaconImage, Info.BeaconPosters.First(bp => bp.Key == GetLevel()).Value, Info.BeaconPosterPalette, Info.BeaconSequence, Info.ArrowSequence, Info.CircleSequence, Info.ClockSequence, () => missile.FractionComplete, Info.BeaconDelay, Info.FlightDelay - Info.BeaconRemoveAdvance); self.World.AddFrameEndTask(w => { w.Add(beacon); }); } }
public override void Activate(Actor self, Order order, SupportPowerManager manager) { base.Activate(self, order, manager); if (self.Owner.IsAlliedWith(self.World.RenderPlayer)) { Sound.Play(Info.LaunchSound); } else { Sound.Play(Info.IncomingSound); } var rb = self.Trait <RenderSimple>(); rb.PlayCustomAnim(self, "active"); var targetPosition = self.World.Map.CenterOfCell(order.TargetLocation); var missile = new NukeLaunch(self.Owner, info.MissileWeapon, self.CenterPosition + body.LocalToWorld(info.SpawnOffset), targetPosition, info.FlightVelocity, info.FlightDelay, info.SkipAscent, info.FlashType); self.World.AddFrameEndTask(w => w.Add(missile)); if (info.CameraActor != null) { var camera = self.World.CreateActor(false, info.CameraActor, new TypeDictionary { new LocationInit(order.TargetLocation), new OwnerInit(self.Owner), }); camera.QueueActivity(new Wait(info.CameraSpawnAdvance + info.CameraRemoveDelay)); camera.QueueActivity(new RemoveSelf()); Action addCamera = () => self.World.AddFrameEndTask(w => w.Add(camera)); self.World.AddFrameEndTask(w => w.Add(new DelayedAction(info.FlightDelay - info.CameraSpawnAdvance, addCamera))); } if (Info.DisplayBeacon) { var beacon = new Beacon( order.Player, targetPosition, Info.BeaconPalettePrefix, Info.BeaconPoster, Info.BeaconPosterPalette, () => missile.FractionComplete); Action removeBeacon = () => self.World.AddFrameEndTask(w => { w.Remove(beacon); beacon = null; }); self.World.AddFrameEndTask(w => { w.Add(beacon); w.Add(new DelayedAction(info.FlightDelay - info.BeaconRemoveAdvance, removeBeacon)); }); } }
public override void Activate(Actor self, Order order, SupportPowerManager manager) { base.Activate(self, order, manager); if (self.Owner.IsAlliedWith(self.World.RenderPlayer)) { Game.Sound.Play(Info.LaunchSound); } else { Game.Sound.Play(Info.IncomingSound); } if (!string.IsNullOrEmpty(info.ActivationSequence)) { var wsb = self.Trait <WithSpriteBody>(); wsb.PlayCustomAnimation(self, info.ActivationSequence, () => wsb.CancelCustomAnimation(self)); } var targetPosition = self.World.Map.CenterOfCell(order.TargetLocation); var palette = info.IsPlayerPalette ? info.MissilePalette + self.Owner.InternalName : info.MissilePalette; var missile = new NukeLaunch(self.Owner, info.MissileWeapon, info.WeaponInfo, palette, info.MissileUp, info.MissileDown, self.CenterPosition + body.LocalToWorld(info.SpawnOffset), targetPosition, info.FlightVelocity, info.FlightDelay, info.SkipAscent, info.FlashType); self.World.AddFrameEndTask(w => w.Add(missile)); if (info.CameraActor != null) { var camera = self.World.CreateActor(false, info.CameraActor, new TypeDictionary { new LocationInit(order.TargetLocation), new OwnerInit(self.Owner), }); camera.QueueActivity(new Wait(info.CameraSpawnAdvance + info.CameraRemoveDelay)); camera.QueueActivity(new RemoveSelf()); Action addCamera = () => self.World.AddFrameEndTask(w => w.Add(camera)); self.World.AddFrameEndTask(w => w.Add(new DelayedAction(info.FlightDelay - info.CameraSpawnAdvance, addCamera))); } if (Info.DisplayBeacon) { var beacon = new Beacon( order.Player, targetPosition, Info.BeaconPaletteIsPlayerPalette, Info.BeaconPalette, Info.BeaconImage, Info.BeaconPoster, Info.BeaconPosterPalette, Info.ArrowSequence, Info.CircleSequence, Info.ClockSequence, () => missile.FractionComplete); Action removeBeacon = () => self.World.AddFrameEndTask(w => { w.Remove(beacon); beacon = null; }); self.World.AddFrameEndTask(w => { w.Add(beacon); w.Add(new DelayedAction(info.FlightDelay - info.BeaconRemoveAdvance, removeBeacon)); }); } }