Skip to content

Commit

Permalink
use constants for animation triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
misternebula committed Mar 14, 2024
1 parent 975c4bd commit a95ac0a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
8 changes: 8 additions & 0 deletions QSB/Animation/Player/AnimationSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ public class AnimationSync : PlayerSyncObject
public Animator InvisibleAnimator { get; private set; }
public NetworkAnimator NetworkAnimator { get; private set; }

public const string HOLD_LANTERN_TRIGGER = "HoldLantern";
public const string HOLD_SHARED_STONE_TRIGGER = "HoldSharedStone";
public const string HOLD_SCROLL_TRIGGER = "HoldScroll";
public const string HOLD_WARP_CORE_TRIGGER = "HoldWarpCore";
public const string HOLD_VESSEL_CORE_TRIGGER = "HoldAdvWarpCore";
public const string HOLD_CONVERSATION_STONE_TRIGGER = "HoldItem";
public const string DROP_HELD_ITEM = "DropHeldItem";

protected void Awake()
{
InvisibleAnimator = gameObject.GetRequiredComponent<Animator>();
Expand Down
5 changes: 3 additions & 2 deletions QSB/CampfireSync/Messages/BurnSlideReelMessage.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using QSB.CampfireSync.WorldObjects;
using QSB.Animation.Player;
using QSB.CampfireSync.WorldObjects;
using QSB.ItemSync.WorldObjects.Items;
using QSB.Messaging;
using QSB.Player;
Expand All @@ -23,7 +24,7 @@ public override void OnReceiveRemote()
campfire._burnedSlideReelSocket,
campfire._sector, null);
fromPlayer.HeldItem = null;
fromPlayer.AnimationSync.VisibleAnimator.SetTrigger("DropHeldItem");
fromPlayer.AnimationSync.VisibleAnimator.SetTrigger(AnimationSync.DROP_HELD_ITEM);
WorldObject.AttachedObject.Burn();
campfire.SetDropSlideReelMode(false);
campfire._hasBurnedSlideReel = true;
Expand Down
5 changes: 3 additions & 2 deletions QSB/ItemSync/Messages/DropItemMessage.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using QSB.ItemSync.WorldObjects;
using QSB.Animation.Player;
using QSB.ItemSync.WorldObjects;
using QSB.ItemSync.WorldObjects.Items;
using QSB.Messaging;
using QSB.Player;
Expand Down Expand Up @@ -69,6 +70,6 @@ public override void OnReceiveRemote()

var player = QSBPlayerManager.GetPlayer(From);
player.HeldItem = null;
player.AnimationSync.VisibleAnimator.SetTrigger("DropHeldItem");
player.AnimationSync.VisibleAnimator.SetTrigger(AnimationSync.DROP_HELD_ITEM);
}
}
15 changes: 8 additions & 7 deletions QSB/ItemSync/Messages/MoveToCarryMessage.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using QSB.ItemSync.WorldObjects.Items;
using QSB.Animation.Player;
using QSB.ItemSync.WorldObjects.Items;
using QSB.Messaging;
using QSB.Player;
using QSB.Utility;
Expand Down Expand Up @@ -39,27 +40,27 @@ public override void OnReceiveRemote()
switch (itemType)
{
case ItemType.Scroll:
player.AnimationSync.VisibleAnimator.SetTrigger("HoldScroll");
player.AnimationSync.VisibleAnimator.SetTrigger(AnimationSync.HOLD_SCROLL_TRIGGER);
break;
case ItemType.WarpCore:
if (((QSBWarpCoreItem)WorldObject).IsVesselCoreType())
{
player.AnimationSync.VisibleAnimator.SetTrigger("HoldAdvWarpCore");
player.AnimationSync.VisibleAnimator.SetTrigger(AnimationSync.HOLD_VESSEL_CORE_TRIGGER);
}
else
{
player.AnimationSync.VisibleAnimator.SetTrigger("HoldWarpCore");
player.AnimationSync.VisibleAnimator.SetTrigger(AnimationSync.HOLD_WARP_CORE_TRIGGER);
}

break;
case ItemType.SharedStone:
player.AnimationSync.VisibleAnimator.SetTrigger("HoldSharedStone");
player.AnimationSync.VisibleAnimator.SetTrigger(AnimationSync.HOLD_SHARED_STONE_TRIGGER);
break;
case ItemType.ConversationStone:
player.AnimationSync.VisibleAnimator.SetTrigger("HoldItem");
player.AnimationSync.VisibleAnimator.SetTrigger(AnimationSync.HOLD_CONVERSATION_STONE_TRIGGER);
break;
case ItemType.Lantern:
player.AnimationSync.VisibleAnimator.SetTrigger("HoldLantern");
player.AnimationSync.VisibleAnimator.SetTrigger(AnimationSync.HOLD_LANTERN_TRIGGER);
break;
case ItemType.SlideReel:
case ItemType.DreamLantern:
Expand Down
5 changes: 3 additions & 2 deletions QSB/ItemSync/Messages/SocketItemMessage.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using QSB.ItemSync.WorldObjects.Items;
using QSB.Animation.Player;
using QSB.ItemSync.WorldObjects.Items;
using QSB.ItemSync.WorldObjects.Sockets;
using QSB.Messaging;
using QSB.Player;
Expand Down Expand Up @@ -29,7 +30,7 @@ public override void OnReceiveRemote()

var player = QSBPlayerManager.GetPlayer(From);
player.HeldItem = null;
player.AnimationSync.VisibleAnimator.SetTrigger("DropHeldItem");
player.AnimationSync.VisibleAnimator.SetTrigger(AnimationSync.DROP_HELD_ITEM);
return;
}
case SocketMessageType.StartUnsocket:
Expand Down

0 comments on commit a95ac0a

Please sign in to comment.