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