quantum-space-buddies/QSB/Animation/Player/Messages/AnimationTriggerMessage.cs

28 lines
582 B
C#
Raw Normal View History

using QSB.Messaging;
2021-12-25 23:03:23 -08:00
using QSB.Player;
using QSB.WorldSync;
2021-04-24 00:10:29 +01:00
2022-03-02 19:46:33 -08:00
namespace QSB.Animation.Player.Messages;
internal class AnimationTriggerMessage : QSBMessage<string>
2021-04-24 00:10:29 +01:00
{
2022-03-10 17:57:50 -08:00
public AnimationTriggerMessage(string name) : base(name) { }
2021-12-25 23:03:23 -08:00
2022-03-02 19:46:33 -08:00
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
2021-12-25 23:03:23 -08:00
2022-03-02 19:46:33 -08:00
public override void OnReceiveRemote()
{
var animationSync = QSBPlayerManager.GetPlayer(From).AnimationSync;
if (animationSync == null)
2021-12-25 23:03:23 -08:00
{
2022-03-02 19:46:33 -08:00
return;
}
2022-03-02 19:46:33 -08:00
if (animationSync.VisibleAnimator == null)
{
return;
}
2022-03-02 19:46:33 -08:00
animationSync.VisibleAnimator.SetTrigger(Data);
2021-04-24 00:10:29 +01:00
}
}