@@ -15,14 +15,16 @@ namespace OpenRA.Graphics
|
||||
{
|
||||
public class Animation
|
||||
{
|
||||
string name;
|
||||
public Sequence CurrentSequence { get; private set; }
|
||||
public bool IsDecoration = false;
|
||||
public Func<bool> Paused;
|
||||
|
||||
Func<int> facingFunc;
|
||||
|
||||
int frame = 0;
|
||||
bool backwards = false;
|
||||
bool tickAlways;
|
||||
|
||||
Func<int> facingFunc;
|
||||
string name;
|
||||
|
||||
public string Name { get { return name; } }
|
||||
|
||||
@@ -122,7 +124,8 @@ namespace OpenRA.Graphics
|
||||
|
||||
public void Tick()
|
||||
{
|
||||
Tick(40); // tick one frame
|
||||
if (Paused == null || !Paused())
|
||||
Tick(40); // tick one frame
|
||||
}
|
||||
|
||||
public bool HasSequence(string seq) { return SequenceProvider.HasSequence(name, seq); }
|
||||
|
||||
@@ -18,17 +18,19 @@ namespace OpenRA.Graphics
|
||||
public readonly Animation Animation;
|
||||
public readonly Func<WVec> OffsetFunc;
|
||||
public readonly Func<bool> DisableFunc;
|
||||
public readonly Func<bool> Paused;
|
||||
public readonly Func<WPos, int> ZOffset;
|
||||
|
||||
public AnimationWithOffset(Animation a, Func<WVec> offset, Func<bool> disable)
|
||||
: this(a, offset, disable, null) { }
|
||||
: this(a, offset, disable, () => false, null) { }
|
||||
|
||||
public AnimationWithOffset(Animation a, Func<WVec> offset, Func<bool> disable, int zOffset)
|
||||
: this(a, offset, disable, _ => zOffset) { }
|
||||
: this(a, offset, disable, () => false, _ => zOffset) { }
|
||||
|
||||
public AnimationWithOffset(Animation a, Func<WVec> offset, Func<bool> disable, Func<WPos, int> zOffset)
|
||||
public AnimationWithOffset(Animation a, Func<WVec> offset, Func<bool> disable, Func<bool> pause, Func<WPos, int> zOffset)
|
||||
{
|
||||
this.Animation = a;
|
||||
this.Animation.Paused = pause;
|
||||
this.OffsetFunc = offset;
|
||||
this.DisableFunc = disable;
|
||||
this.ZOffset = zOffset;
|
||||
@@ -45,7 +47,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
public static implicit operator AnimationWithOffset(Animation a)
|
||||
{
|
||||
return new AnimationWithOffset(a, null, null, null);
|
||||
return new AnimationWithOffset(a, null, null, null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRA.Traits
|
||||
{
|
||||
get { return anims[""].Animation; }
|
||||
protected set { anims[""] = new AnimationWithOffset(value,
|
||||
anims[""].OffsetFunc, anims[""].DisableFunc, anims[""].ZOffset); }
|
||||
anims[""].OffsetFunc, anims[""].DisableFunc, anims[""].Paused, anims[""].ZOffset); }
|
||||
}
|
||||
|
||||
RenderSpritesInfo Info;
|
||||
|
||||
Reference in New Issue
Block a user