fixes WEAP roof when selling.
This commit is contained in:
@@ -46,6 +46,7 @@ namespace OpenRa.Graphics
|
|||||||
|
|
||||||
public void PlayThen( string sequenceName, Action after )
|
public void PlayThen( string sequenceName, Action after )
|
||||||
{
|
{
|
||||||
|
after = after ?? ( () => { } );
|
||||||
backwards = false;
|
backwards = false;
|
||||||
tickAlways = false;
|
tickAlways = false;
|
||||||
CurrentSequence = SequenceProvider.GetSequence( name, sequenceName );
|
CurrentSequence = SequenceProvider.GetSequence( name, sequenceName );
|
||||||
@@ -112,5 +113,10 @@ namespace OpenRa.Graphics
|
|||||||
ReplaceAnim(CurrentSequence.Name);
|
ReplaceAnim(CurrentSequence.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Sequence GetSequence( string sequenceName )
|
||||||
|
{
|
||||||
|
return SequenceProvider.GetSequence( name, sequenceName );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ namespace OpenRa.Traits.Activities
|
|||||||
|
|
||||||
bool started;
|
bool started;
|
||||||
|
|
||||||
|
int framesRemaining;
|
||||||
|
|
||||||
void DoSell(Actor self)
|
void DoSell(Actor self)
|
||||||
{
|
{
|
||||||
var cost = self.Info.Traits.Get<BuildableInfo>().Cost;
|
var cost = self.Info.Traits.Get<BuildableInfo>().Cost;
|
||||||
@@ -21,7 +23,7 @@ namespace OpenRa.Traits.Activities
|
|||||||
self.Health = 0;
|
self.Health = 0;
|
||||||
foreach (var ns in self.traits.WithInterface<INotifySold>())
|
foreach (var ns in self.traits.WithInterface<INotifySold>())
|
||||||
ns.Sold(self);
|
ns.Sold(self);
|
||||||
Game.world.Remove(self);
|
Game.world.AddFrameEndTask( _ => Game.world.Remove( self ) );
|
||||||
|
|
||||||
// todo: give dudes
|
// todo: give dudes
|
||||||
}
|
}
|
||||||
@@ -30,14 +32,17 @@ namespace OpenRa.Traits.Activities
|
|||||||
{
|
{
|
||||||
if( !started )
|
if( !started )
|
||||||
{
|
{
|
||||||
var rb = self.traits.Get<RenderBuilding>();
|
framesRemaining = self.traits.Get<RenderSimple>().anim.GetSequence( "make" ).Length;
|
||||||
//var rb = self.traits.Get<RenderBuilding>();
|
foreach( var ns in self.traits.WithInterface<INotifySold>() )
|
||||||
rb.PlayCustomAnimBackwards(self, "make",
|
ns.Selling( self );
|
||||||
() => Game.world.AddFrameEndTask(w => DoSell(self)));
|
|
||||||
|
|
||||||
Sound.Play("cashturn.aud");
|
|
||||||
started = true;
|
started = true;
|
||||||
}
|
}
|
||||||
|
else if( framesRemaining <= 0 )
|
||||||
|
DoSell( self );
|
||||||
|
|
||||||
|
else
|
||||||
|
--framesRemaining;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,12 @@ namespace OpenRa.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Selling( Actor self )
|
||||||
|
{
|
||||||
|
anim.PlayBackwardsThen( "make", null );
|
||||||
|
Sound.Play("cashturn.aud");
|
||||||
|
}
|
||||||
|
|
||||||
public void Sold(Actor self) { DoBib(self, true); }
|
public void Sold(Actor self) { DoBib(self, true); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace OpenRa.Traits
|
|||||||
public object Create(Actor self) { return new RenderWarFactory(self); }
|
public object Create(Actor self) { return new RenderWarFactory(self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RenderWarFactory : INotifyBuildComplete, INotifyDamage, ITick, INotifyProduction
|
class RenderWarFactory : INotifyBuildComplete, INotifyDamage, ITick, INotifyProduction, INotifySold
|
||||||
{
|
{
|
||||||
public Animation roof;
|
public Animation roof;
|
||||||
[Sync]
|
[Sync]
|
||||||
@@ -59,5 +59,12 @@ namespace OpenRa.Traits
|
|||||||
{
|
{
|
||||||
roof.PlayThen(GetPrefix(self) + "build-top", () => isOpen = true);
|
roof.PlayThen(GetPrefix(self) + "build-top", () => isOpen = true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Selling( Actor self )
|
||||||
|
{
|
||||||
|
self.traits.Get<RenderSimple>().anims.Remove( "roof" );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Sold( Actor self ) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace OpenRa.Traits
|
|||||||
public interface IIssueOrder { Order IssueOrder( Actor self, int2 xy, MouseInput mi, Actor underCursor ); }
|
public interface IIssueOrder { Order IssueOrder( Actor self, int2 xy, MouseInput mi, Actor underCursor ); }
|
||||||
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
|
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
|
||||||
|
|
||||||
public interface INotifySold { void Sold(Actor self); }
|
public interface INotifySold { void Selling( Actor self ); void Sold( Actor self ); }
|
||||||
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
||||||
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
|
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
|
||||||
public interface INotifyProduction { void UnitProduced(Actor self, Actor other); }
|
public interface INotifyProduction { void UnitProduced(Actor self, Actor other); }
|
||||||
|
|||||||
Reference in New Issue
Block a user