quantum-space-buddies/QSB/Animation/Player/Messages/AnimationTriggerMessage.cs
2022-03-02 19:46:33 -08:00

28 lines
581 B
C#

using QSB.Messaging;
using QSB.Player;
using QSB.WorldSync;
namespace QSB.Animation.Player.Messages;
internal class AnimationTriggerMessage : QSBMessage<string>
{
public AnimationTriggerMessage(string name) => Data = name;
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
public override void OnReceiveRemote()
{
var animationSync = QSBPlayerManager.GetPlayer(From).AnimationSync;
if (animationSync == null)
{
return;
}
if (animationSync.VisibleAnimator == null)
{
return;
}
animationSync.VisibleAnimator.SetTrigger(Data);
}
}