Fix light animations (#20263)
This commit is contained in:
@@ -30,7 +30,7 @@ public sealed partial class TriggerSystem
|
||||
{
|
||||
ComponentType = typeof(PointLightComponent),
|
||||
InterpolationMode = AnimationInterpolationMode.Nearest,
|
||||
Property = nameof(PointLightComponent.Radius),
|
||||
Property = nameof(PointLightComponent.AnimatedRadius),
|
||||
KeyFrames =
|
||||
{
|
||||
new AnimationTrackProperty.KeyFrame(0.1f, 0),
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Client.Light.Components
|
||||
[DataField("id")] public string ID { get; set; } = string.Empty;
|
||||
|
||||
[DataField("property")]
|
||||
public virtual string Property { get; protected set; } = "Radius";
|
||||
public virtual string Property { get; protected set; } = nameof(PointLightComponent.AnimatedRadius);
|
||||
|
||||
[DataField("isLooped")] public bool IsLooped { get; set; }
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Content.Client.Light.Components
|
||||
var playingTime = prevPlayingTime + frameTime;
|
||||
var interpolateValue = playingTime / MaxTime;
|
||||
|
||||
if (Property == "Enabled") // special case for boolean
|
||||
if (Property == nameof(PointLightComponent.AnimatedEnable)) // special case for boolean
|
||||
{
|
||||
ApplyProperty(interpolateValue < 0.5f);
|
||||
return (-1, playingTime);
|
||||
@@ -181,7 +181,7 @@ namespace Content.Client.Light.Components
|
||||
var playingTime = prevPlayingTime + frameTime;
|
||||
var interpolateValue = playingTime / MaxTime;
|
||||
|
||||
if (Property == "Enabled") // special case for boolean
|
||||
if (Property == nameof(PointLightComponent.AnimatedEnable)) // special case for boolean
|
||||
{
|
||||
ApplyProperty(interpolateValue < EndValue);
|
||||
return (-1, playingTime);
|
||||
@@ -245,7 +245,7 @@ namespace Content.Client.Light.Components
|
||||
|
||||
public override void OnStart()
|
||||
{
|
||||
if (Property == "Enabled") // special case for boolean, we randomize it
|
||||
if (Property == nameof(PointLightComponent.AnimatedEnable)) // special case for boolean, we randomize it
|
||||
{
|
||||
ApplyProperty(_random.NextDouble() < 0.5);
|
||||
return;
|
||||
@@ -267,7 +267,7 @@ namespace Content.Client.Light.Components
|
||||
var playingTime = prevPlayingTime + frameTime;
|
||||
var interpolateValue = playingTime / MaxTime;
|
||||
|
||||
if (Property == "Enabled")
|
||||
if (Property == nameof(PointLightComponent.AnimatedEnable))
|
||||
{
|
||||
return (-1, playingTime);
|
||||
}
|
||||
@@ -298,7 +298,7 @@ namespace Content.Client.Light.Components
|
||||
public sealed partial class ColorCycleBehaviour : LightBehaviourAnimationTrack, ISerializationHooks
|
||||
{
|
||||
[DataField("property")]
|
||||
public override string Property { get; protected set; } = "Color";
|
||||
public override string Property { get; protected set; } = nameof(PointLightComponent.Color);
|
||||
|
||||
[DataField("colors")] public List<Color> ColorsToCycle { get; set; } = new();
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ public sealed class PoweredLightVisualizerSystem : VisualizerSystem<PoweredLight
|
||||
{
|
||||
ComponentType = typeof(PointLightComponent),
|
||||
InterpolationMode = AnimationInterpolationMode.Nearest,
|
||||
Property = nameof(PointLightComponent.Enabled),
|
||||
Property = nameof(PointLightComponent.AnimatedEnable),
|
||||
KeyFrames =
|
||||
{
|
||||
new AnimationTrackProperty.KeyFrame(false, 0),
|
||||
|
||||
@@ -334,7 +334,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
new AnimationTrackComponentProperty
|
||||
{
|
||||
ComponentType = typeof(PointLightComponent),
|
||||
Property = nameof(PointLightComponent.Enabled),
|
||||
Property = nameof(PointLightComponent.AnimatedEnable),
|
||||
InterpolationMode = AnimationInterpolationMode.Linear,
|
||||
KeyFrames =
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user