Пример #1
0
        /// <summary>
        /// Play the animation specified by state
        /// </summary>
        /// <param name="state"></param>
        public void Play(string state)
        {
            var stateInfo = at.GetCurrentAnimatorStateInfo(0);
            int from      = stateInfo.shortNameHash;
            int to        = Animator.StringToHash(state);

            if (!at.HasState(0, to))
            {
                Debug.LogWarning("Playing a missing animation state: " + state);
            }

            LocalEventTracer.AddTraceEvent(new AnimChangeEvent(this, from, to, stateInfo.normalizedTime));
        }
Пример #2
0
        /// <summary>
        /// Fire a trigger to invoke state transitions.
        /// Will record state change events for tracing.
        /// </summary>
        public bool Fire(TTrigger trigger)
        {
            TState oldState = stateMachine.State;
            float  oldTimer = StateTimer;

            bool val = transitionManager.Fire(trigger);

            if (val)
            {
                LocalEventTracer.AddTraceEvent(new StateChangeEvent <TTrigger, TState>(
                                                   this, oldState, stateMachine.State, oldTimer
                                                   ));
            }

            return(val);
        }