public void Sync(KAnimControllerBase controller)
 {
     if (!((Object)masterController == (Object)null) && !((Object)controller == (Object)null))
     {
         KAnim.Anim currentAnim = masterController.GetCurrentAnim();
         if (currentAnim != null)
         {
             KAnim.PlayMode mode        = masterController.GetMode();
             float          playSpeed   = masterController.GetPlaySpeed();
             float          elapsedTime = masterController.GetElapsedTime();
             controller.Play(currentAnim.name, mode, playSpeed, elapsedTime);
             Facing component = controller.GetComponent <Facing>();
             if ((Object)component != (Object)null)
             {
                 Vector3 position = component.transform.GetPosition();
                 float   x        = position.x;
                 x += ((!masterController.FlipX) ? 0.5f : (-0.5f));
                 component.Face(x);
             }
             else
             {
                 controller.FlipX = masterController.FlipX;
                 controller.FlipY = masterController.FlipY;
             }
         }
     }
 }
コード例 #2
0
ファイル: KAnimPatches.cs プロジェクト: peterhaneve/ONIMods
        /// <summary>
        /// Applied before IsStopped runs.
        /// </summary>
        internal static bool Prefix(KAnimControllerBase __instance, ref bool __result)
        {
            bool stopped = __instance.stopped;

            if (stopped)
            {
                var anim = __instance.GetCurrentAnim();
                var mode = __instance.GetMode();
                var inst = KAnimLoopOptimizer.Instance;
                // The desalinator is the stress test for this, it does an anim queue complete
                // wait on a trivial kanim... Clay please!
                if (anim != null && mode == KAnim.PlayMode.Paused && anim.numFrames > 0 &&
                    __instance.currentFrame == 0 && inst != null && inst.GetAnimState(anim,
                                                                                      KAnim.PlayMode.Loop) == mode)
                {
                    stopped = false;
                }
            }
            __result = stopped;
            return(false);
        }