- fix: animations
This commit is contained in:
@@ -42,31 +42,28 @@ public sealed class Interactions : EntitySystem
|
|||||||
|
|
||||||
private void OnSlapButt(EntityUid uid, InteractionPanelComponent component, InteractionBeginningEvent args)
|
private void OnSlapButt(EntityUid uid, InteractionPanelComponent component, InteractionBeginningEvent args)
|
||||||
{
|
{
|
||||||
if(!TryComp<InputMoverComponent>(uid,out var moverComponent))
|
var rotation = (Transform(args.Target).LocalPosition - Transform(args.Performer).LocalPosition)*0.5f;
|
||||||
return;
|
|
||||||
|
|
||||||
var viewerRot = moverComponent.TargetRelativeRotation;
|
var animation = new Shared._Amour.Animation.Animation()
|
||||||
var rotation = (Transform(args.Performer).LocalRotation - viewerRot).ToWorldVec()*0.25f;
|
|
||||||
|
|
||||||
|
|
||||||
_animationSystem.Play(uid,new AnimationData()
|
|
||||||
{
|
{
|
||||||
Length = TimeSpan.FromSeconds(0.5),
|
Length = TimeSpan.FromSeconds(0.5),
|
||||||
AnimationTracks =
|
AnimationTracks =
|
||||||
{
|
{
|
||||||
new AnimationTrackData()
|
new AnimationTrackData()
|
||||||
{
|
{
|
||||||
ComponentType = "SpriteComponent",
|
ComponentType = "Sprite",
|
||||||
Property = "Offset",
|
Property = "Offset",
|
||||||
InterpolationMode = AnimationInterpolationMode.Cubic,
|
InterpolationMode = AnimationInterpolationMode.Cubic,
|
||||||
KeyFrames =
|
KeyFrames =
|
||||||
{
|
{
|
||||||
_animationSystem.KeyFrame(Vector2.Zero,0),
|
_animationSystem.KeyFrame(Vector2.Zero, 0),
|
||||||
_animationSystem.KeyFrame(rotation,0.150f),
|
_animationSystem.KeyFrame(rotation, 0.100f),
|
||||||
_animationSystem.KeyFrame(Vector2.Zero,0.250f)
|
_animationSystem.KeyFrame(Vector2.Zero, 0.250f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
_animationSystem.Play(uid,animation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,26 +3,31 @@ using Robust.Shared.Serialization;
|
|||||||
|
|
||||||
namespace Content.Shared._Amour.Animation;
|
namespace Content.Shared._Amour.Animation;
|
||||||
|
|
||||||
[DataDefinition,Serializable,NetSerializable,Virtual]
|
[DataDefinition,Serializable,NetSerializable]
|
||||||
public partial class AnimationData
|
public abstract partial class AnimationData
|
||||||
|
{
|
||||||
|
[DataField] public TimeSpan Length = TimeSpan.Zero;
|
||||||
|
[DataField] public List<AnimationTrackData> AnimationTracks = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
[DataDefinition,Serializable,NetSerializable]
|
||||||
|
public sealed partial class Animation : AnimationData
|
||||||
{
|
{
|
||||||
[DataField] public TimeSpan Length;
|
|
||||||
[DataField] public List<AnimationTrackData> AnimationTracks;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataDefinition, Serializable, NetSerializable]
|
[DataDefinition, Serializable, NetSerializable]
|
||||||
public sealed partial class AnimationTrackData
|
public sealed partial class AnimationTrackData
|
||||||
{
|
{
|
||||||
[DataField] public string ComponentType;
|
[DataField] public string ComponentType = "Sprite";
|
||||||
[DataField] public string Property;
|
[DataField] public string Property = "Scale";
|
||||||
[DataField] public AnimationInterpolationMode InterpolationMode;
|
[DataField] public AnimationInterpolationMode InterpolationMode = AnimationInterpolationMode.Previous;
|
||||||
[DataField] public List<AnimationKeyData> KeyFrames;
|
[DataField] public List<AnimationKeyData> KeyFrames = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataDefinition, Serializable, NetSerializable]
|
[DataDefinition, Serializable, NetSerializable]
|
||||||
public sealed partial class AnimationKeyData
|
public sealed partial class AnimationKeyData
|
||||||
{
|
{
|
||||||
[DataField] public string Value;
|
[DataField] public string Value = "0";
|
||||||
[DataField] public float KeyTime;
|
[DataField] public float KeyTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,5 +2,6 @@
|
|||||||
id: SlapButt
|
id: SlapButt
|
||||||
checks:
|
checks:
|
||||||
- !type:HasSmallDistance
|
- !type:HasSmallDistance
|
||||||
|
- !type:CantInteractSelf
|
||||||
beginningMessages:
|
beginningMessages:
|
||||||
- interaction-butt-slap
|
- interaction-butt-slap
|
||||||
|
|||||||
Reference in New Issue
Block a user