using UnityEngine; /// /// Attach this script directly to the child GameObject that has the Animator component (e.g., "Model"). /// It will catch Animation Events triggered by the animations and forward them up to the parent GameObject /// where your actual combat scripts (like MeleeCombatLayerController) are sitting! /// public class AnimationEventRelay : MonoBehaviour { // ========================================== // MELEE EVENTS // ========================================== public void DealDamage() { if (transform.parent != null) { transform.parent.SendMessageUpwards("DealDamage", SendMessageOptions.DontRequireReceiver); } } public void Hit() { if (transform.parent != null) { transform.parent.SendMessageUpwards("Hit", SendMessageOptions.DontRequireReceiver); } } public void loadArrow() { if (transform.parent != null) { transform.parent.SendMessageUpwards("loadArrow", SendMessageOptions.DontRequireReceiver); } } public void Fire() { if (transform.parent != null) { transform.parent.SendMessageUpwards("Fire", SendMessageOptions.DontRequireReceiver); } } public void FootR() { if (transform.parent != null) { transform.parent.SendMessageUpwards("FootR", SendMessageOptions.DontRequireReceiver); } } public void FootL() { if (transform.parent != null) { transform.parent.SendMessageUpwards("FootL", SendMessageOptions.DontRequireReceiver); } } }