Exemplo n.º 1
0
        /************************************************************************************************************************/

        /// <summary>
        /// As with <see cref="HitBall"/>, this method is called in various different ways depending on which event
        /// system is being used.
        /// <para></para>
        /// Most of them register this method to be called when the <see cref="_Swing"/> animation ends, but
        /// <see cref="GolfHitControllerAnimancer"/> assumes that the event was already set up in the Inspector.
        /// </summary>
        public void EndSwing()
        {
            _State = State.Idle;

            // Since the swing animation is ending early, we want it to calculate the fade duration to fade out over
            // the remainder of that animation instead of the value specified by the _Idle transition.
            var fadeDuration = EndEventReceiver.GetFadeOutDuration();

            _Animancer.Play(_Idle, fadeDuration);
        }
Exemplo n.º 2
0
        /************************************************************************************************************************/

        /// <summary>Calls <see cref="EndEventReceiver.End"/>.</summary>
        /// <remarks>
        /// Called by Animation Events with the Function Name "End".
        /// <para></para>
        /// Note that Unity will allocate some garbage every time it triggers an Animation Event with an
        /// <see cref="AnimationEvent"/> parameter.
        /// </remarks>
        private void End(AnimationEvent animationEvent)
        {
            EndEventReceiver.End(_Animancer, animationEvent);
        }