2019-09-18 22:14:21 +02:00
|
|
|
using System;
|
|
|
|
|
using Robust.Client.Animations;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Client.GameObjects;
|
2019-09-18 22:14:21 +02:00
|
|
|
using Robust.Shared.Animations;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-12-03 11:55:25 +01:00
|
|
|
using Robust.Shared.IoC;
|
2019-09-18 22:14:21 +02:00
|
|
|
using Robust.Shared.Maths;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.Animations
|
2019-09-18 22:14:21 +02:00
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
|
|
|
|
public sealed class AnimationsTestComponent : Component
|
|
|
|
|
{
|
2021-06-19 19:41:26 -07:00
|
|
|
protected override void Initialize()
|
2019-09-18 22:14:21 +02:00
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
2021-12-03 15:53:09 +01:00
|
|
|
var animations = IoCManager.Resolve<IEntityManager>().GetComponent<AnimationPlayerComponent>(Owner);
|
2019-09-18 22:14:21 +02:00
|
|
|
animations.Play(new Animation
|
|
|
|
|
{
|
|
|
|
|
Length = TimeSpan.FromSeconds(20),
|
|
|
|
|
AnimationTracks =
|
|
|
|
|
{
|
|
|
|
|
new AnimationTrackComponentProperty
|
|
|
|
|
{
|
2021-11-08 12:37:32 +01:00
|
|
|
ComponentType = typeof(TransformComponent),
|
|
|
|
|
Property = nameof(TransformComponent.LocalRotation),
|
2019-09-18 22:14:21 +02:00
|
|
|
InterpolationMode = AnimationInterpolationMode.Linear,
|
|
|
|
|
KeyFrames =
|
|
|
|
|
{
|
|
|
|
|
new AnimationTrackProperty.KeyFrame(Angle.Zero, 0),
|
|
|
|
|
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(1440), 20)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new AnimationTrackComponentProperty
|
|
|
|
|
{
|
|
|
|
|
ComponentType = typeof(ISpriteComponent),
|
|
|
|
|
Property = "layer/0/texture",
|
|
|
|
|
KeyFrames =
|
|
|
|
|
{
|
|
|
|
|
new AnimationTrackProperty.KeyFrame("Objects/toolbox_r.png", 0),
|
|
|
|
|
new AnimationTrackProperty.KeyFrame("Objects/Toolbox_b.png", 5),
|
|
|
|
|
new AnimationTrackProperty.KeyFrame("Objects/Toolbox_y.png", 5),
|
|
|
|
|
new AnimationTrackProperty.KeyFrame("Objects/toolbox_r.png", 5),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, "yes");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|