Removed RenderUnit

Used this opportunity to unhardcode several sandworm-related sequences.
This commit is contained in:
reaperrr
2015-06-23 21:49:57 +02:00
parent 76aaafe37c
commit 2be06e610a
8 changed files with 54 additions and 69 deletions

View File

@@ -1,50 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2015 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Render trait for non-animated actors that have sprites facing into each direction.",
"Deprecated. This will soon be removed, use RenderSprites + WithFacingSpriteBody instead.")]
public class RenderUnitInfo : RenderSimpleInfo, Requires<IFacingInfo>
{
public override object Create(ActorInitializer init) { return new RenderUnit(init, this); }
}
public class RenderUnit : RenderSimple, ISpriteBody
{
readonly RenderUnitInfo info;
public RenderUnit(ActorInitializer init, RenderUnitInfo info)
: base(init, info)
{
this.info = info;
}
public void PlayCustomAnimation(Actor self, string newAnimation, Action after)
{
DefaultAnimation.PlayThen(newAnimation, () => { DefaultAnimation.Play(info.Sequence); if (after != null) after(); });
}
public void PlayCustomAnimationRepeating(Actor self, string name)
{
DefaultAnimation.PlayThen(name,
() => PlayCustomAnimationRepeating(self, name));
}
public void PlayCustomAnimationBackwards(Actor self, string name, Action after)
{
DefaultAnimation.PlayBackwardsThen(name,
() => { DefaultAnimation.PlayRepeating(info.Sequence); if (after != null) after(); });
}
}
}