mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-16 15:22:27 +02:00
* Removed the Interfaces folder. * All objects inside the GameObjects subfolders are now in the GameObjects namespace. * Added a Resharper DotSettings file to mark the GameObjects subfolders as not providing namespaces. * Simplified Robust.client.Graphics namespace. * Automated remove redundant using statements.
35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
using System;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.Animations;
|
|
using Robust.Shared.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)
|
|
{
|
|
if (Property == null || ComponentType == null)
|
|
{
|
|
throw new InvalidOperationException("Must set parameters to non-null values.");
|
|
}
|
|
|
|
var entity = (IEntity) context;
|
|
var component = entity.GetComponent(ComponentType);
|
|
|
|
if (component is IAnimationProperties properties)
|
|
{
|
|
properties.SetAnimatableProperty(Property, value);
|
|
}
|
|
else
|
|
{
|
|
AnimationHelper.SetAnimatableProperty(component, Property, value);
|
|
}
|
|
}
|
|
}
|
|
}
|