facings for bullets, where appropriate.
This commit is contained in:
@@ -46,11 +46,12 @@ namespace OpenRa.Effects
|
|||||||
|
|
||||||
if (Projectile.Image != null && Projectile.Image != "none")
|
if (Projectile.Image != null && Projectile.Image != "none")
|
||||||
{
|
{
|
||||||
anim = new Animation(Projectile.Image);
|
|
||||||
if (Projectile.Rotates)
|
if (Projectile.Rotates)
|
||||||
Traits.Util.PlayFacing(anim, "idle", () => Traits.Util.GetFacing((dest - src).ToFloat2(), 0));
|
anim = new Animation(Projectile.Image, () => Traits.Util.GetFacing((dest - src).ToFloat2(), 0));
|
||||||
else
|
else
|
||||||
anim.PlayRepeating("idle");
|
anim = new Animation(Projectile.Image);
|
||||||
|
|
||||||
|
anim.PlayRepeating("idle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,12 +35,12 @@ namespace OpenRa.Effects
|
|||||||
|
|
||||||
if (Projectile.Image != null && Projectile.Image != "none")
|
if (Projectile.Image != null && Projectile.Image != "none")
|
||||||
{
|
{
|
||||||
anim = new Animation(Projectile.Image);
|
|
||||||
|
|
||||||
if (Projectile.Rotates)
|
if (Projectile.Rotates)
|
||||||
Traits.Util.PlayFacing(anim, "idle", () => Facing);
|
anim = new Animation(Projectile.Image, () => Facing);
|
||||||
else
|
else
|
||||||
anim.PlayRepeating("idle");
|
anim = new Animation(Projectile.Image);
|
||||||
|
|
||||||
|
anim.PlayRepeating("idle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,13 +43,6 @@ namespace OpenRa.Traits
|
|||||||
return highest * 8;
|
return highest * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PlayFacing(this Animation anim, string sequenceName, Func<int> facing)
|
|
||||||
{
|
|
||||||
anim.PlayFetchIndex(sequenceName,
|
|
||||||
() => Traits.Util.QuantizeFacing(facing(),
|
|
||||||
anim.CurrentSequence.Length));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int GetNearestFacing( int facing, int desiredFacing )
|
public static int GetNearestFacing( int facing, int desiredFacing )
|
||||||
{
|
{
|
||||||
var turn = desiredFacing - facing;
|
var turn = desiredFacing - facing;
|
||||||
@@ -87,7 +80,7 @@ namespace OpenRa.Traits
|
|||||||
if (rut == null) return float2.Zero;
|
if (rut == null) return float2.Zero;
|
||||||
|
|
||||||
var facing = self.traits.Get<Turreted>().turretFacing;
|
var facing = self.traits.Get<Turreted>().turretFacing;
|
||||||
var quantizedFacing = QuantizeFacing(facing, rut.anim.CurrentSequence.Length) * (256 / rut.anim.CurrentSequence.Length);
|
var quantizedFacing = QuantizeFacing(facing, rut.anim.CurrentSequence.Facings) * (256 / rut.anim.CurrentSequence.Length);
|
||||||
|
|
||||||
return RotateVectorByFacing(new float2(0, recoil * self.Info.Traits.Get<AttackBaseInfo>().Recoil), quantizedFacing, .7f);
|
return RotateVectorByFacing(new float2(0, recoil * self.Info.Traits.Get<AttackBaseInfo>().Recoil), quantizedFacing, .7f);
|
||||||
}
|
}
|
||||||
@@ -107,7 +100,7 @@ namespace OpenRa.Traits
|
|||||||
if( unit == null ) return int2.Zero; /* things that don't have a rotating base don't need the turrets repositioned */
|
if( unit == null ) return int2.Zero; /* things that don't have a rotating base don't need the turrets repositioned */
|
||||||
|
|
||||||
var ru = self.traits.GetOrDefault<RenderUnit>();
|
var ru = self.traits.GetOrDefault<RenderUnit>();
|
||||||
var numDirs = (ru != null) ? ru.anim.CurrentSequence.Length : 8;
|
var numDirs = (ru != null) ? ru.anim.CurrentSequence.Facings : 8;
|
||||||
var bodyFacing = unit.Facing;
|
var bodyFacing = unit.Facing;
|
||||||
var quantizedFacing = QuantizeFacing(bodyFacing, numDirs) * (256 / numDirs);
|
var quantizedFacing = QuantizeFacing(bodyFacing, numDirs) * (256 / numDirs);
|
||||||
|
|
||||||
|
|||||||
@@ -485,7 +485,7 @@
|
|||||||
<sequence name="unload" start="35" length="1" />
|
<sequence name="unload" start="35" length="1" />
|
||||||
</unit>
|
</unit>
|
||||||
<unit name="v2">
|
<unit name="v2">
|
||||||
<sequence name="idle" start="0" length="32" />
|
<sequence name="idle" start="0" facings="32" />
|
||||||
</unit>
|
</unit>
|
||||||
<unit name="flagfly">
|
<unit name="flagfly">
|
||||||
<sequence name="idle" start="0" length="14" />
|
<sequence name="idle" start="0" length="14" />
|
||||||
@@ -606,7 +606,7 @@
|
|||||||
<sequence name="idle" start="0" length="1" />
|
<sequence name="idle" start="0" length="1" />
|
||||||
</unit>
|
</unit>
|
||||||
<unit name="dragon">
|
<unit name="dragon">
|
||||||
<sequence name="idle" start="0" length="32" />
|
<sequence name="idle" start="0" facings="32" />
|
||||||
</unit>
|
</unit>
|
||||||
<unit name="smokey">
|
<unit name="smokey">
|
||||||
<sequence name="idle" start="0" length="7" />
|
<sequence name="idle" start="0" length="7" />
|
||||||
@@ -639,7 +639,7 @@
|
|||||||
<sequence name="die6" start="0" length="17" src="electdog" />
|
<sequence name="die6" start="0" length="17" src="electdog" />
|
||||||
</unit>
|
</unit>
|
||||||
<unit name="missile">
|
<unit name="missile">
|
||||||
<sequence name="idle" start="0" length="32" />
|
<sequence name="idle" start="0" facings="32" />
|
||||||
</unit>
|
</unit>
|
||||||
<unit name="spy">
|
<unit name="spy">
|
||||||
<sequence name="stand" start="0" facings="8" />
|
<sequence name="stand" start="0" facings="8" />
|
||||||
|
|||||||
Reference in New Issue
Block a user