From 7f493f682503f5186308de7b8f74b5b49233cfe4 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Thu, 2 Nov 2023 11:51:31 +0800 Subject: +init --- GameCode/PlayerAttackAnimator.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 GameCode/PlayerAttackAnimator.cs (limited to 'GameCode/PlayerAttackAnimator.cs') diff --git a/GameCode/PlayerAttackAnimator.cs b/GameCode/PlayerAttackAnimator.cs new file mode 100644 index 0000000..10407a6 --- /dev/null +++ b/GameCode/PlayerAttackAnimator.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using UnityEngine; + +public class PlayerAttackAnimator : MonoBehaviour +{ + public List animations = new List(); + + private ManualAttack playerAttack; + + public void AssignAttack(ManualAttack attack) + { + playerAttack = attack; + playerAttack.onAttack.AddListener(TriggerAnimations); + } + + private void TriggerAnimations() + { + if (!base.gameObject.activeInHierarchy) + { + return; + } + foreach (OneShotAnimationBase animation in animations) + { + animation.Trigger(); + } + } +} -- cgit v1.1-26-g67d0