Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.LeftArrow))
     {
         activeCameraID = (activeCameraID + 1) % cameras.Length;
         SetCameraEnable(activeCameraID);
     }
     else if (Input.GetKeyDown(KeyCode.RightArrow))
     {
         activeCameraID = (activeCameraID - 1 + cameras.Length) % cameras.Length;
         SetCameraEnable(activeCameraID);
     }
     else if (Input.GetKeyDown(KeyCode.P))
     {
         if (fakeScene.IsPlaying)
         {
             fakeScene.Play(false);
         }
         else
         {
             fakeScene.Play(true);
         }
     }
     else if (Input.GetKeyDown(KeyCode.S))
     {
         SaveScreenShot();
     }
 }
 public override void OnBehaviourPause(Playable playable, FrameData info)
 {
     if (Plugin)
     {
         Plugin.Play(false);
     }
 }
    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        Plugin = playerData as Plugin4DS;

        if (onstart)
        {
            if (Plugin == null)
            {
                return;
            }

            double duration = playable.GetDuration() * Plugin.Framerate;
            double newSpeed = 1;

            if (firstFrame < lastFrame && firstFrame >= 0)
            {
                newSpeed = (lastFrame - firstFrame) / duration;
                //Debug.Log("new speed : " + newSpeed);
            }
            else
            {
                newSpeed = (Plugin.SequenceNbOfFrames - firstFrame) / duration;
                //Debug.Log("new speed : " + newSpeed);
            }

            Plugin.SpeedRatio = (float)newSpeed;
            Plugin.GotoFrame(firstFrame);
            Plugin.Play(true);

            onstart = false;
        }

        base.ProcessFrame(playable, info, playerData);
    }