2022-01-27 01:32:27 -08:00
|
|
|
|
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-02-24 22:04:54 -08:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
if (animationSync.VisibleAnimator == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
2022-02-27 04:40:44 -08:00
|
|
|
|
}
|
2022-03-02 19:46:33 -08:00
|
|
|
|
|
|
|
|
|
animationSync.VisibleAnimator.SetTrigger(Data);
|
2021-04-24 00:10:29 +01:00
|
|
|
|
}
|
2022-02-24 22:04:54 -08:00
|
|
|
|
}
|