mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-02 18:17:09 +02:00
* WiP property animations system * Use better lerp for Angle property animations. * Fix handling of offset in sprite component. * Allow animating some sprite layer properties. * Allow animating some Transform properties. Obviously not advisable for server entities, but great for client side entities! * Improve animation property interpolation handling. Added a "previous" mode. Made values that cannot be sanely interpolated fall back to this mode. * Improve some animation docs.
30 lines
857 B
C#
30 lines
857 B
C#
using System;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.Animations;
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
|
|
namespace Robust.Client.Animations
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed class AnimationTrackComponentProperty : AnimationTrackProperty
|
|
{
|
|
public Type ComponentType { get; set; }
|
|
public string Property { get; set; }
|
|
|
|
protected override void ApplyProperty(object context, object value)
|
|
{
|
|
var entity = (IEntity) context;
|
|
var component = entity.GetComponent(ComponentType);
|
|
|
|
if (component is IAnimationProperties properties)
|
|
{
|
|
properties.SetAnimatableProperty(Property, value);
|
|
}
|
|
else
|
|
{
|
|
AnimationHelper.SetAnimatableProperty(component, Property, value);
|
|
}
|
|
}
|
|
}
|
|
}
|