fix IdleAnimation. add IsAttacking to AttackBase
This commit is contained in:
@@ -27,6 +27,14 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override IActivity Tick( Actor self )
|
public override IActivity Tick( Actor self )
|
||||||
|
{
|
||||||
|
var attack = self.Trait<AttackBase>();
|
||||||
|
var ret = InnerTick( self, attack );
|
||||||
|
attack.IsAttacking = ( ret == this );
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
IActivity InnerTick( Actor self, AttackBase attack )
|
||||||
{
|
{
|
||||||
if (IsCanceled) return NextActivity;
|
if (IsCanceled) return NextActivity;
|
||||||
var facing = self.Trait<IFacing>();
|
var facing = self.Trait<IFacing>();
|
||||||
@@ -49,7 +57,6 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
return Util.SequenceActivities( new Turn( desiredFacing ), this );
|
return Util.SequenceActivities( new Turn( desiredFacing ), this );
|
||||||
}
|
}
|
||||||
|
|
||||||
var attack = self.Trait<AttackBase>();
|
|
||||||
attack.target = Target;
|
attack.target = Target;
|
||||||
attack.DoAttack(self);
|
attack.DoAttack(self);
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public class AttackBase : IIssueOrder, IResolveOrder, ITick, IExplodeModifier, IOrderCursor, IOrderVoice
|
public class AttackBase : IIssueOrder, IResolveOrder, ITick, IExplodeModifier, IOrderCursor, IOrderVoice
|
||||||
{
|
{
|
||||||
|
public bool IsAttacking { get; internal set; }
|
||||||
public Target target;
|
public Target target;
|
||||||
|
|
||||||
public List<Weapon> Weapons = new List<Weapon>();
|
public List<Weapon> Weapons = new List<Weapon>();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA
|
|||||||
if (target != null)
|
if (target != null)
|
||||||
attack.ResolveOrder(self, new Order("Attack", self, target));
|
attack.ResolveOrder(self, new Order("Attack", self, target));
|
||||||
else
|
else
|
||||||
if (self.GetCurrentActivity() is Attack)
|
if (attack.IsAttacking)
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Damaged(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (self.GetCurrentActivity() is IdleAnimation)
|
if (self.GetCurrentActivity() is Activities.IdleAnimation)
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,13 +24,11 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
|
|
||||||
public override void Tick(Actor self)
|
public override void Tick(Actor self)
|
||||||
{
|
{
|
||||||
var isAttacking = self.GetCurrentActivity() is Attack;
|
|
||||||
|
|
||||||
var attack = self.TraitOrDefault<AttackBase>();
|
var attack = self.TraitOrDefault<AttackBase>();
|
||||||
|
|
||||||
if (attack != null)
|
if (attack != null)
|
||||||
anim.ReplaceAnim((attack.IsReloading() ? "empty-" : "")
|
anim.ReplaceAnim((attack.IsReloading() ? "empty-" : "")
|
||||||
+ (isAttacking ? "aim" : "idle"));
|
+ (attack.IsAttacking ? "aim" : "idle"));
|
||||||
base.Tick(self);
|
base.Tick(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user