Add a lantern and a radiating light component (#1571)

* added a lantern

* Add A Lantern with radiating light

* Update meta.json

Added copyright information for lantern.rsi
This commit is contained in:
SoulSloth
2020-08-09 15:57:42 -04:00
committed by GitHub
parent 81e2dde7f5
commit 52a01fff32
9 changed files with 174 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
using System;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Client.GameObjects.Components.Animations;
using Robust.Shared.Animations;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
namespace Content.Client.GameObjects.Components
{
[RegisterComponent]
public class RadiatingLightComponent : Component
{
public override string Name => "RadiatingLight";
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.Radius),
KeyFrames =
{
new AnimationTrackProperty.KeyFrame(3.0f, 0),
new AnimationTrackProperty.KeyFrame(2.0f, 1),
new AnimationTrackProperty.KeyFrame(3.0f, 2)
}
}
}
};
var playerComponent = Owner.EnsureComponent<AnimationPlayerComponent>();
playerComponent.Play(animation, "emergency");
playerComponent.AnimationCompleted += s => playerComponent.Play(animation, s);
}
}
}