Files
tbd-station-14/Content.Client/GameObjects/Components/EmergencyLightComponent.cs
Acruid ca4fd649fe Massive Namespace Cleanup (#3120)
* Engine namespace changes.

* Automated remove redundant using statements.

* Simplified Graphics namespace.

* Apparently the container system stores full type names in the map file.😞 This updates those names.

* API Changes to LocalizationManager.LoadCulture.

* Update submodule to v0.3.2
2021-02-11 01:13:03 -08:00

46 lines
1.5 KiB
C#

using System;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Shared.Animations;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
namespace Content.Client.GameObjects.Components
{
[RegisterComponent]
public class EmergencyLightComponent : Component
{
public override string Name => "EmergencyLight";
/// <inheritdoc/>
protected override void Startup()
{
base.Startup();
var animation = new Animation
{
Length = TimeSpan.FromSeconds(4),
AnimationTracks =
{
new AnimationTrackComponentProperty
{
ComponentType = typeof(PointLightComponent),
InterpolationMode = AnimationInterpolationMode.Linear,
Property = nameof(PointLightComponent.Rotation),
KeyFrames =
{
new AnimationTrackProperty.KeyFrame(Angle.Zero, 0),
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(1080), 4)
}
}
}
};
var playerComponent = Owner.EnsureComponent<AnimationPlayerComponent>();
playerComponent.Play(animation, "emergency");
playerComponent.AnimationCompleted += s => playerComponent.Play(animation, s);
}
}
}