Supersede INotifyNuke
This commit is contained in:
committed by
atlimit8
parent
b3b0aa75ae
commit
52d0490f95
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
public override object Create(ActorInitializer init) { return new WithNukeLaunchAnimation(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithNukeLaunchAnimation(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithNukeLaunchAnimation : ConditionalTrait<WithNukeLaunchAnimationInfo>, INotifyNuke
|
public class WithNukeLaunchAnimation : ConditionalTrait<WithNukeLaunchAnimationInfo>, INotifySupportPower
|
||||||
{
|
{
|
||||||
readonly WithSpriteBody wsb;
|
readonly WithSpriteBody wsb;
|
||||||
|
|
||||||
@@ -37,7 +37,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
wsb = self.TraitsImplementing<WithSpriteBody>().Single(w => w.Info.Name == Info.Body);
|
wsb = self.TraitsImplementing<WithSpriteBody>().Single(w => w.Info.Name == Info.Body);
|
||||||
}
|
}
|
||||||
|
|
||||||
void INotifyNuke.Launching(Actor self)
|
void INotifySupportPower.Charged(Actor self) { }
|
||||||
|
|
||||||
|
void INotifySupportPower.Activated(Actor self)
|
||||||
{
|
{
|
||||||
if (!IsTraitDisabled)
|
if (!IsTraitDisabled)
|
||||||
wsb.PlayCustomAnimation(self, Info.Sequence, () => wsb.CancelCustomAnimation(self));
|
wsb.PlayCustomAnimation(self, Info.Sequence, () => wsb.CancelCustomAnimation(self));
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
public override object Create(ActorInitializer init) { return new WithNukeLaunchOverlay(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithNukeLaunchOverlay(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithNukeLaunchOverlay : ConditionalTrait<WithNukeLaunchOverlayInfo>, INotifyNuke
|
public class WithNukeLaunchOverlay : ConditionalTrait<WithNukeLaunchOverlayInfo>, INotifySupportPower
|
||||||
{
|
{
|
||||||
readonly Animation overlay;
|
readonly Animation overlay;
|
||||||
bool visible;
|
bool visible;
|
||||||
@@ -56,7 +56,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
rs.Add(anim, info.Palette, info.IsPlayerPalette);
|
rs.Add(anim, info.Palette, info.IsPlayerPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
void INotifyNuke.Launching(Actor self)
|
void INotifySupportPower.Charged(Actor self) { }
|
||||||
|
|
||||||
|
void INotifySupportPower.Activated(Actor self)
|
||||||
{
|
{
|
||||||
visible = true;
|
visible = true;
|
||||||
overlay.PlayThen(overlay.CurrentSequence.Name, () => visible = false);
|
overlay.PlayThen(overlay.CurrentSequence.Name, () => visible = false);
|
||||||
|
|||||||
@@ -148,9 +148,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public void Activate(Actor self, WPos targetPosition)
|
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 palette = info.IsPlayerPalette ? info.MissilePalette + self.Owner.InternalName : info.MissilePalette;
|
||||||
var skipAscent = info.SkipAscent || body == null;
|
var skipAscent = info.SkipAscent || body == null;
|
||||||
var launchPos = skipAscent ? WPos.Zero : self.CenterPosition + body.LocalToWorld(info.SpawnOffset);
|
var launchPos = skipAscent ? WPos.Zero : self.CenterPosition + body.LocalToWorld(info.SpawnOffset);
|
||||||
|
|||||||
@@ -136,7 +136,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public interface INotifySupportPower { void Charged(Actor self); void Activated(Actor self); }
|
public interface INotifySupportPower { void Charged(Actor self); void Activated(Actor self); }
|
||||||
|
|
||||||
public interface INotifyBuildingPlaced { void BuildingPlaced(Actor self); }
|
public interface INotifyBuildingPlaced { void BuildingPlaced(Actor self); }
|
||||||
public interface INotifyNuke { void Launching(Actor self); }
|
|
||||||
public interface INotifyBurstComplete { void FiredBurst(Actor self, Target target, Armament a); }
|
public interface INotifyBurstComplete { void FiredBurst(Actor self, Target target, Armament a); }
|
||||||
public interface INotifyChat { bool OnChat(string from, string message); }
|
public interface INotifyChat { bool OnChat(string from, string message); }
|
||||||
public interface INotifyProduction { void UnitProduced(Actor self, Actor other, CPos exit); }
|
public interface INotifyProduction { void UnitProduced(Actor self, Actor other, CPos exit); }
|
||||||
|
|||||||
Reference in New Issue
Block a user