Files
AppleHillsProduction/Assets/Scripts/Movement/FollowerAnimationEventBridge.cs
2025-10-27 14:43:24 +01:00

41 lines
1.3 KiB
C#

using UnityEngine;
namespace Movement
{
/// <summary>
/// Bridge script that forwards Animation Events from the character art child object
/// to the FollowerController on the parent GameObject.
/// Attach this to the same GameObject that has the Animator component.
/// </summary>
public class FollowerAnimationEventBridge : MonoBehaviour
{
[SerializeField] private FollowerController followerController;
void Awake()
{
// Find the FollowerController on the parent
if (followerController == null)
{
followerController = GetComponentInParent<FollowerController>();
}
if (followerController == null)
{
Debug.LogError("[FollowerAnimationEventBridge] Could not find FollowerController in parent. This script must be on a child of the FollowerController.");
}
}
/// <summary>
/// Called by Animation Events. Forwards to the parent FollowerController.
/// </summary>
public void OnStationaryAnimationComplete()
{
if (followerController != null)
{
followerController.OnStationaryAnimationComplete();
}
}
}
}