spears and mace (#66)
This commit is contained in:
@@ -14,8 +14,6 @@ public sealed partial class MeleeWeaponSystem
|
||||
private const string SlashAnimationKey = "melee-slash";
|
||||
private const string ThrustAnimationKey = "melee-thrust";
|
||||
|
||||
private const string CPSlashLightAnimationKey = "cp-melee-slash-light"; //CrystallPunk Melee upgrade
|
||||
|
||||
/// <summary>
|
||||
/// Does all of the melee effects for a player that are predicted, i.e. character lunge and weapon animation.
|
||||
/// </summary>
|
||||
@@ -45,7 +43,6 @@ public sealed partial class MeleeWeaponSystem
|
||||
}
|
||||
|
||||
var length = 1f; //CrystallPunk Melee upgrade
|
||||
var scale = 1f; //CrystallPunk Melee upgrade
|
||||
var offset = -1f; //CrystallPunk Melee upgrade
|
||||
|
||||
var spriteRotation = Angle.Zero;
|
||||
@@ -62,12 +59,10 @@ public sealed partial class MeleeWeaponSystem
|
||||
angle *= -1;
|
||||
|
||||
length = meleeWeaponComponent.CPAnimationLength; //CrystallPunk Melee upgrade
|
||||
scale = meleeWeaponComponent.CPAnimationScale; //CrystallPunk Melee upgrade
|
||||
offset = meleeWeaponComponent.CPAnimationOffset; //CrystallPunk Melee upgrade
|
||||
}
|
||||
sprite.NoRotation = true;
|
||||
sprite.Rotation = localPos.ToWorldAngle();
|
||||
sprite.Scale = new Vector2(scale); //CrystallPunk Melee upgrade
|
||||
var distance = Math.Clamp(localPos.Length() / 2f, 0.2f, 1f);
|
||||
|
||||
var xform = _xformQuery.GetComponent(animationUid);
|
||||
@@ -96,12 +91,17 @@ public sealed partial class MeleeWeaponSystem
|
||||
_animation.Play(animationUid, GetFadeAnimation(sprite, 0f, 0.15f), FadeAnimationKey);
|
||||
break;
|
||||
//CrystallPunk MeleeUpgrade
|
||||
case WeaponArcAnimation.CPSlashLight:
|
||||
_animation.Play(animationUid, CPGetSlashLightAnimation(sprite, angle, spriteRotation, length, offset), CPSlashLightAnimationKey);
|
||||
case WeaponArcAnimation.CPSlash:
|
||||
_animation.Play(animationUid, CPGetSlashAnimation(sprite, angle, spriteRotation, length, offset), SlashAnimationKey);
|
||||
TransformSystem.SetParent(animationUid, xform, user, userXform);
|
||||
if (arcComponent.Fadeout)
|
||||
_animation.Play(animationUid, GetFadeAnimation(sprite, length * 0.5f, length + 0.15f), FadeAnimationKey);
|
||||
|
||||
break;
|
||||
case WeaponArcAnimation.CPThrust:
|
||||
_animation.Play(animationUid, CPGetThrustAnimation(sprite, -offset, spriteRotation, length), ThrustAnimationKey);
|
||||
TransformSystem.SetParent(animationUid, xform, user, userXform);
|
||||
if (arcComponent.Fadeout)
|
||||
_animation.Play(animationUid, GetFadeAnimation(sprite, 0f, 0.15f), FadeAnimationKey);
|
||||
break;
|
||||
//CrystallPunk MeleeUpgrade end
|
||||
}
|
||||
@@ -219,8 +219,8 @@ public sealed partial class MeleeWeaponSystem
|
||||
KeyFrames =
|
||||
{
|
||||
new AnimationTrackProperty.KeyFrame(Vector2.Zero, 0f), //CrystallPunk MeleeUpgrade
|
||||
new AnimationTrackProperty.KeyFrame(direction.Normalized() * 0.15f, length/2), //CrystallPunk MeleeUpgrade
|
||||
new AnimationTrackProperty.KeyFrame(Vector2.Zero, length)
|
||||
new AnimationTrackProperty.KeyFrame(direction.Normalized() * 0.15f, length*0.4f), //CrystallPunk MeleeUpgrade
|
||||
new AnimationTrackProperty.KeyFrame(Vector2.Zero, length*0.8f) //CrystallPunk MeleeUpgrade
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,7 +228,7 @@ public sealed partial class MeleeWeaponSystem
|
||||
}
|
||||
|
||||
//CrystallPunk MeleeUpgrade start
|
||||
private Animation CPGetSlashLightAnimation(SpriteComponent sprite, Angle arc, Angle spriteRotation, float length, float offset = -1f)
|
||||
private Animation CPGetSlashAnimation(SpriteComponent sprite, Angle arc, Angle spriteRotation, float length, float offset = -1f)
|
||||
{
|
||||
var startRotation = sprite.Rotation + (arc * 0.5f);
|
||||
var endRotation = sprite.Rotation - (arc * 0.5f);
|
||||
@@ -270,6 +270,34 @@ public sealed partial class MeleeWeaponSystem
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Animation CPGetThrustAnimation(SpriteComponent sprite, float distance, Angle spriteRotation, float length)
|
||||
{
|
||||
var startOffset = sprite.Rotation.RotateVec(new Vector2(0f, -distance / 5f));
|
||||
var endOffset = sprite.Rotation.RotateVec(new Vector2(0f, -distance));
|
||||
|
||||
sprite.Rotation += spriteRotation;
|
||||
|
||||
return new Animation()
|
||||
{
|
||||
Length = TimeSpan.FromSeconds(length),
|
||||
AnimationTracks =
|
||||
{
|
||||
new AnimationTrackComponentProperty()
|
||||
{
|
||||
ComponentType = typeof(SpriteComponent),
|
||||
Property = nameof(SpriteComponent.Offset),
|
||||
KeyFrames =
|
||||
{
|
||||
new AnimationTrackProperty.KeyFrame(Vector2.Lerp(startOffset, endOffset, 0f), length * 0f),
|
||||
new AnimationTrackProperty.KeyFrame(Vector2.Lerp(startOffset, endOffset, 1f), length * 0.5f),
|
||||
new AnimationTrackProperty.KeyFrame(Vector2.Lerp(startOffset, endOffset, 0.9f), length * 0.8f),
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//CrystallPunk MeleeUpgrade end
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user