Add Flashlight Visualizer/states (#1861)

* Add art assets for cloning

* Added a 'Scan DNA' button to the medical scanner

* Made the UI update unconditional for the medical scanner until checks for power changes are in place

* Update Medical scanner to reflect powered status and fix #1774

* added a 'scan dna' button the the medical scanner that will add the contained bodies Uid to a list in CloningSystem, fixed an issue with the menu not populating if the scanner starts in an unpowered state

* Add disabling logic to 'Scan DNA' button on medical scanner

* Removed un-used libraries

* Added playing parameter to radiatingLightComponent, changed it's animation key to radiatingLight

* refactored RadiatingLight into a visualizer

* Added different light animations for differnt power states of a flashlight

* split out the radiating light visualizer into two seperate visualizers

* further refactored and tweaked handheldlight animations

* further lantern light tweaks

* removed un-used attributes in flashlight and lantern prototypes

* fix null check in handheldlightcomponent
This commit is contained in:
SoulSloth
2020-08-24 06:32:18 -04:00
committed by GitHub
parent 769a371be6
commit df823d2245
9 changed files with 243 additions and 80 deletions

View File

@@ -0,0 +1,56 @@
using System;
using Content.Shared.GameObjects.Components;
using JetBrains.Annotations;
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.Utility;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components
{
[UsedImplicitly]
public class LanternVisualizer : AppearanceVisualizer
{
private readonly Animation _radiatingLightAnimation = new Animation
{
Length = TimeSpan.FromSeconds(5),
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.5f),
new AnimationTrackProperty.KeyFrame(3.0f, 3f)
}
}
}
};
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
if (component.Deleted)
{
return;
}
PlayAnimation(component);
}
private void PlayAnimation(AppearanceComponent component)
{
component.Owner.EnsureComponent(out AnimationPlayerComponent animationPlayer);
if (animationPlayer.HasRunningAnimation("radiatingLight")) return;
animationPlayer.Play(_radiatingLightAnimation, "radiatingLight");
animationPlayer.AnimationCompleted += s => animationPlayer.Play(_radiatingLightAnimation, s);
}
}
}