Make combine animations and smacks ground Pulve
This commit is contained in:
40
Assets/Scripts/Movement/FollowerAnimationEventBridge.cs
Normal file
40
Assets/Scripts/Movement/FollowerAnimationEventBridge.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user