Update `DoorComponent` to use TimeSpans and fix comments (#40420)
Cleanup
This commit is contained in:
@@ -31,7 +31,7 @@ public sealed class DoorSystem : SharedDoorSystem
|
|||||||
|
|
||||||
comp.OpeningAnimation = new Animation
|
comp.OpeningAnimation = new Animation
|
||||||
{
|
{
|
||||||
Length = TimeSpan.FromSeconds(comp.OpeningAnimationTime),
|
Length = comp.OpeningAnimationTime,
|
||||||
AnimationTracks =
|
AnimationTracks =
|
||||||
{
|
{
|
||||||
new AnimationTrackSpriteFlick
|
new AnimationTrackSpriteFlick
|
||||||
@@ -47,7 +47,7 @@ public sealed class DoorSystem : SharedDoorSystem
|
|||||||
|
|
||||||
comp.ClosingAnimation = new Animation
|
comp.ClosingAnimation = new Animation
|
||||||
{
|
{
|
||||||
Length = TimeSpan.FromSeconds(comp.ClosingAnimationTime),
|
Length = comp.ClosingAnimationTime,
|
||||||
AnimationTracks =
|
AnimationTracks =
|
||||||
{
|
{
|
||||||
new AnimationTrackSpriteFlick
|
new AnimationTrackSpriteFlick
|
||||||
@@ -63,7 +63,7 @@ public sealed class DoorSystem : SharedDoorSystem
|
|||||||
|
|
||||||
comp.EmaggingAnimation = new Animation
|
comp.EmaggingAnimation = new Animation
|
||||||
{
|
{
|
||||||
Length = TimeSpan.FromSeconds(comp.EmaggingAnimationTime),
|
Length = comp.EmaggingAnimationTime,
|
||||||
AnimationTracks =
|
AnimationTracks =
|
||||||
{
|
{
|
||||||
new AnimationTrackSpriteFlick
|
new AnimationTrackSpriteFlick
|
||||||
@@ -116,14 +116,14 @@ public sealed class DoorSystem : SharedDoorSystem
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
case DoorState.Opening:
|
case DoorState.Opening:
|
||||||
if (entity.Comp.OpeningAnimationTime == 0.0)
|
if (entity.Comp.OpeningAnimationTime == TimeSpan.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_animationSystem.Play(entity, (Animation)entity.Comp.OpeningAnimation, DoorComponent.AnimationKey);
|
_animationSystem.Play(entity, (Animation)entity.Comp.OpeningAnimation, DoorComponent.AnimationKey);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case DoorState.Closing:
|
case DoorState.Closing:
|
||||||
if (entity.Comp.ClosingAnimationTime == 0.0 || entity.Comp.CurrentlyCrushing.Count != 0)
|
if (entity.Comp.ClosingAnimationTime == TimeSpan.Zero || entity.Comp.CurrentlyCrushing.Count != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_animationSystem.Play(entity, (Animation)entity.Comp.ClosingAnimation, DoorComponent.AnimationKey);
|
_animationSystem.Play(entity, (Animation)entity.Comp.ClosingAnimation, DoorComponent.AnimationKey);
|
||||||
|
|||||||
@@ -187,22 +187,22 @@ public sealed partial class DoorComponent : Component
|
|||||||
public string EmaggingSpriteState = "sparks";
|
public string EmaggingSpriteState = "sparks";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The sprite state used for the door when it's open.
|
/// The length of the door's opening animation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField]
|
[DataField]
|
||||||
public float OpeningAnimationTime = 0.8f;
|
public TimeSpan OpeningAnimationTime = TimeSpan.FromSeconds(0.8);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The sprite state used for the door when it's open.
|
/// The length of the door's closing animation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField]
|
[DataField]
|
||||||
public float ClosingAnimationTime = 0.8f;
|
public TimeSpan ClosingAnimationTime = TimeSpan.FromSeconds(0.8);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The sprite state used for the door when it's open.
|
/// The length of the door's emagging animation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField]
|
[DataField]
|
||||||
public float EmaggingAnimationTime = 1.5f;
|
public TimeSpan EmaggingAnimationTime = TimeSpan.FromSeconds(1.5);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The animation used when the door opens.
|
/// The animation used when the door opens.
|
||||||
|
|||||||
Reference in New Issue
Block a user