spy disguise works
This commit is contained in:
@@ -4,12 +4,14 @@ namespace OpenRa.Game.Graphics
|
|||||||
{
|
{
|
||||||
class Animation
|
class Animation
|
||||||
{
|
{
|
||||||
readonly string name;
|
string name;
|
||||||
public Sequence CurrentSequence { get; private set; }
|
public Sequence CurrentSequence { get; private set; }
|
||||||
int frame = 0;
|
int frame = 0;
|
||||||
bool backwards = false;
|
bool backwards = false;
|
||||||
bool tickAlways;
|
bool tickAlways;
|
||||||
|
|
||||||
|
public string Name { get { return name; } }
|
||||||
|
|
||||||
public Animation( string name )
|
public Animation( string name )
|
||||||
{
|
{
|
||||||
this.name = name.ToLowerInvariant();
|
this.name = name.ToLowerInvariant();
|
||||||
@@ -99,5 +101,16 @@ namespace OpenRa.Game.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ChangeImage(string newImage)
|
||||||
|
{
|
||||||
|
newImage = newImage.ToLowerInvariant();
|
||||||
|
|
||||||
|
if (name != newImage)
|
||||||
|
{
|
||||||
|
name = newImage.ToLowerInvariant();
|
||||||
|
ReplaceAnim(CurrentSequence.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace OpenRa.Game.Traits
|
|||||||
abstract class RenderSimple : IRender, ITick
|
abstract class RenderSimple : IRender, ITick
|
||||||
{
|
{
|
||||||
public Dictionary<string, AnimationWithOffset> anims = new Dictionary<string, AnimationWithOffset>();
|
public Dictionary<string, AnimationWithOffset> anims = new Dictionary<string, AnimationWithOffset>();
|
||||||
public Animation anim { get { return anims[""].Animation; } protected set { anims[""].Animation = anim; } }
|
public Animation anim { get { return anims[""].Animation; } protected set { anims[""].Animation = value; } }
|
||||||
|
|
||||||
public string GetImage(Actor self)
|
public string GetImage(Actor self)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ namespace OpenRa.Game.Traits
|
|||||||
public RenderSpy(Actor self)
|
public RenderSpy(Actor self)
|
||||||
: base(self)
|
: base(self)
|
||||||
{
|
{
|
||||||
if (self.Owner != Game.LocalPlayer)
|
|
||||||
anim = new Animation("e1");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
|
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
|
||||||
@@ -27,5 +25,11 @@ namespace OpenRa.Game.Traits
|
|||||||
|
|
||||||
return r.Select(a => a.WithPalette(Game.LocalPlayer.Palette));
|
return r.Select(a => a.WithPalette(Game.LocalPlayer.Palette));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Tick(Actor self)
|
||||||
|
{
|
||||||
|
anim.ChangeImage(self.Owner == Game.LocalPlayer ? GetImage(self) : "e1");
|
||||||
|
base.Tick(self);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user