Enable nullability in Content.Client (#3257)
* Enable nullability in Content.Client * Remove #nullable enable * Merge fixes * Remove Debug.Assert * Merge fixes * Fix build * Fix build
This commit is contained in:
@@ -1,32 +1,31 @@
|
||||
using System;
|
||||
using Robust.Client.Animations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Animations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.Animations
|
||||
{
|
||||
public static class ReusableAnimations
|
||||
{
|
||||
|
||||
public static void AnimateEntityPickup(IEntity entity, EntityCoordinates initialPosition, Vector2 finalPosition)
|
||||
{
|
||||
var animatableClone = entity.EntityManager.SpawnEntity("clientsideclone", initialPosition);
|
||||
animatableClone.Name = entity.Name;
|
||||
|
||||
if(!entity.TryGetComponent(out SpriteComponent sprite0))
|
||||
if (!entity.TryGetComponent(out SpriteComponent? sprite0))
|
||||
{
|
||||
Logger.Error($"Entity ({0}) couldn't be animated for pickup since it doesn't have a {1}!", entity.Name, nameof(SpriteComponent));
|
||||
Logger.Error("Entity ({0}) couldn't be animated for pickup since it doesn't have a {1}!", entity.Name, nameof(SpriteComponent));
|
||||
return;
|
||||
}
|
||||
var sprite = animatableClone.GetComponent<SpriteComponent>();
|
||||
sprite.CopyFrom(sprite0);
|
||||
|
||||
var animations = animatableClone.GetComponent<AnimationPlayerComponent>();
|
||||
animations.AnimationCompleted += (s) => {
|
||||
animations.AnimationCompleted += (_) => {
|
||||
animatableClone.Delete();
|
||||
};
|
||||
|
||||
@@ -42,13 +41,12 @@ namespace Content.Client.Animations
|
||||
InterpolationMode = AnimationInterpolationMode.Linear,
|
||||
KeyFrames =
|
||||
{
|
||||
new AnimationTrackComponentProperty.KeyFrame(initialPosition.Position, 0),
|
||||
new AnimationTrackComponentProperty.KeyFrame(finalPosition, 0.125f)
|
||||
new AnimationTrackProperty.KeyFrame(initialPosition.Position, 0),
|
||||
new AnimationTrackProperty.KeyFrame(finalPosition, 0.125f)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, "fancy_pickup_anim");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user