// Animancer // Copyright 2020 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
using UnityEngine;
namespace Animancer.Examples.Events
{
///
/// An that uses Animation Events.
///
[AddComponentMenu(Strings.MenuPrefix + "Examples/Golf Events - Animation")]
[HelpURL(Strings.APIDocumentationURL + ".Examples.AnimationEvents/GolfHitControllerAnimation")]
public sealed class GolfHitControllerAnimation : GolfHitController
{
/************************************************************************************************************************/
///
/// Calls the base method and register
/// to be called whenever the swing animation ends.
///
/// Normally Animancer could call the registered method at the End Time defined in the transition, but in this
/// case the used with this script has an Animation Event with the Function Name
/// "End", which will execute the registered method when that event time passes.
///
protected override void Awake()
{
base.Awake();
_Swing.Events.Sequence.OnEnd = EndSwing;
}
/************************************************************************************************************************/
///
/// Calls . The used with this script has an
/// Animation Event with the Function Name "Event", which will cause it to execute this method.
///
/// Normally you would just have the event use "HitBall" as its Function Name directly, but the same animation
/// is also being used for which relies on the Function Name
/// being "Event".
///
private void Event()
{
HitBall();
}
/************************************************************************************************************************/
}
}