Make NukePower MissileImage optional.
This commit is contained in:
committed by
Matthias Mailänder
parent
60b123c641
commit
c71af0e613
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
bool isLaunched;
|
bool isLaunched;
|
||||||
bool detonated;
|
bool detonated;
|
||||||
|
|
||||||
public NukeLaunch(Player firedBy, string name, WeaponInfo weapon, string weaponPalette, string upSequence, string downSequence,
|
public NukeLaunch(Player firedBy, string image, WeaponInfo weapon, string weaponPalette, string upSequence, string downSequence,
|
||||||
WPos launchPos, WPos targetPos, WDist detonationAltitude, bool removeOnDetonation, WDist velocity, int launchDelay, int impactDelay,
|
WPos launchPos, WPos targetPos, WDist detonationAltitude, bool removeOnDetonation, WDist velocity, int launchDelay, int impactDelay,
|
||||||
bool skipAscent,
|
bool skipAscent,
|
||||||
string trailImage, string[] trailSequences, string trailPalette, bool trailUsePlayerPalette, int trailDelay, int trailInterval)
|
string trailImage, string[] trailSequences, string trailPalette, bool trailUsePlayerPalette, int trailDelay, int trailInterval)
|
||||||
@@ -78,7 +78,8 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
this.detonationAltitude = detonationAltitude;
|
this.detonationAltitude = detonationAltitude;
|
||||||
this.removeOnDetonation = removeOnDetonation;
|
this.removeOnDetonation = removeOnDetonation;
|
||||||
|
|
||||||
anim = new Animation(firedBy.World, name);
|
if (!string.IsNullOrEmpty(image))
|
||||||
|
anim = new Animation(firedBy.World, image);
|
||||||
|
|
||||||
pos = skipAscent ? descendSource : ascendSource;
|
pos = skipAscent ? descendSource : ascendSource;
|
||||||
}
|
}
|
||||||
@@ -90,18 +91,25 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
|
|
||||||
if (!isLaunched)
|
if (!isLaunched)
|
||||||
{
|
{
|
||||||
anim.PlayRepeating(upSequence);
|
|
||||||
if (weapon.Report != null && weapon.Report.Any())
|
if (weapon.Report != null && weapon.Report.Any())
|
||||||
Game.Sound.Play(SoundType.World, weapon.Report, world, pos);
|
Game.Sound.Play(SoundType.World, weapon.Report, world, pos);
|
||||||
|
|
||||||
world.ScreenMap.Add(this, pos, anim.Image);
|
if (anim != null)
|
||||||
|
{
|
||||||
|
anim.PlayRepeating(upSequence);
|
||||||
|
world.ScreenMap.Add(this, pos, anim.Image);
|
||||||
|
}
|
||||||
|
|
||||||
isLaunched = true;
|
isLaunched = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
anim.Tick();
|
if (anim != null)
|
||||||
|
{
|
||||||
|
anim.Tick();
|
||||||
|
|
||||||
if (ticks == turn)
|
if (ticks == turn)
|
||||||
anim.PlayRepeating(downSequence);
|
anim.PlayRepeating(downSequence);
|
||||||
|
}
|
||||||
|
|
||||||
var isDescending = ticks >= turn;
|
var isDescending = ticks >= turn;
|
||||||
if (!isDescending)
|
if (!isDescending)
|
||||||
@@ -124,7 +132,8 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
if (ticks == impactDelay || (isDescending && dat <= detonationAltitude))
|
if (ticks == impactDelay || (isDescending && dat <= detonationAltitude))
|
||||||
Explode(world, ticks == impactDelay || removeOnDetonation);
|
Explode(world, ticks == impactDelay || removeOnDetonation);
|
||||||
|
|
||||||
world.ScreenMap.Update(this, pos, anim.Image);
|
if (anim != null)
|
||||||
|
world.ScreenMap.Update(this, pos, anim.Image);
|
||||||
|
|
||||||
ticks++;
|
ticks++;
|
||||||
}
|
}
|
||||||
@@ -153,7 +162,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
|
|
||||||
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
if (!isLaunched)
|
if (!isLaunched || anim == null)
|
||||||
return Enumerable.Empty<IRenderable>();
|
return Enumerable.Empty<IRenderable>();
|
||||||
|
|
||||||
return anim.Render(pos, wr.Palette(weaponPalette));
|
return anim.Render(pos, wr.Palette(weaponPalette));
|
||||||
|
|||||||
Reference in New Issue
Block a user