示例#1
0
        /// <summary>
        /// Adjusts the play mode if the anim is trivial.
        /// </summary>
        internal static KAnim.PlayMode UpdateMode(KAnim.PlayMode mode,
                                                  KAnimControllerBase controller)
        {
            var anim = controller.GetCurrentAnim();
            var inst = KAnimLoopOptimizer.Instance;

            if (anim != null && mode == KAnim.PlayMode.Loop && inst != null && controller.
                animQueue.Count == 0)
            {
                // Will set "paused" only if the anim is so short as to be unnoticeable
                mode = inst.GetAnimState(anim, mode);
                if (mode == KAnim.PlayMode.Paused)
                {
                    // Trigger an instant stop
                    controller.Stop();
                    controller.currentFrame = 0;
                    controller.SetElapsedTime(0.0f);
                    PathPatches.DeferAnimQueueTrigger.TriggerAndQueue(controller,
                                                                      (int)GameHashes.AnimQueueComplete, null);
                }
            }
            return(mode);
        }