.Trait[OrDefault]<Trait> => .Info.Traits.Get[OrDefault]<TraitInfo> where applicable

This commit is contained in:
atlimit8
2015-08-02 18:31:57 -05:00
parent 8162fa27ab
commit 6970959ef1
16 changed files with 55 additions and 81 deletions

View File

@@ -16,13 +16,13 @@ namespace OpenRA.Mods.Common.Activities
public class SpriteHarvesterDockSequence : HarvesterDockSequence
{
readonly WithSpriteBody wsb;
readonly WithDockingAnimation wda;
readonly WithDockingAnimationInfo wda;
public SpriteHarvesterDockSequence(Actor self, Actor refinery, int dockAngle, bool isDragRequired, WVec dragOffset, int dragLength)
: base(self, refinery, dockAngle, isDragRequired, dragOffset, dragLength)
{
wsb = self.Trait<WithSpriteBody>();
wda = self.Trait<WithDockingAnimation>();
wda = self.Info.Traits.Get<WithDockingAnimationInfo>();
}
public override Activity OnStateDock(Actor self)
@@ -30,14 +30,14 @@ namespace OpenRA.Mods.Common.Activities
foreach (var trait in self.TraitsImplementing<INotifyHarvesterAction>())
trait.Docked();
wsb.PlayCustomAnimation(self, wda.Info.DockSequence, () => wsb.PlayCustomAnimationRepeating(self, wda.Info.DockLoopSequence));
wsb.PlayCustomAnimation(self, wda.DockSequence, () => wsb.PlayCustomAnimationRepeating(self, wda.DockLoopSequence));
dockingState = State.Loop;
return this;
}
public override Activity OnStateUndock(Actor self)
{
wsb.PlayCustomAnimationBackwards(self, wda.Info.DockSequence,
wsb.PlayCustomAnimationBackwards(self, wda.DockSequence,
() =>
{
dockingState = State.Complete;