Example #1
0
        // Called each frame while the state is set to Play
        public override void PrepareFrame(Playable playable, FrameData info)
        {
            //idk how i got this but its the timeline time so its ok i guess?
            var time = info.output.GetSourcePlayable().GetTime();

            switch (type)
            {
            //keyboard handling
            case StaticTrackType.KeyJoy:
                //change states when necessary
                if (Math.Abs(time - clip.start) < 0.019)      //around 60 fps time epsilon
                {
                    SuperInput.ChangeKeyState(key, KeyState.Pressed, this);
                }
                else if (Math.Abs(time - clip.end) < 0.019)
                {
                    SuperInput.ChangeKeyState(key, KeyState.Released, this);
                }
                else
                {
                    SuperInput.ChangeKeyState(key, KeyState.Held, this);
                }
                break;
            }
        }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     if (SuperInput.GetKey(KeyCode.R))
     {
         GetComponent <Renderer>().sharedMaterial.color = Color.red;
     }
     else
     {
         GetComponent <Renderer>().sharedMaterial.color = Color.white;
     }
 }
 // Called each frame while the state is set to Play
 public override void PrepareFrame(Playable playable, FrameData info)
 {
     switch(type)
     {
         case DynamicTrackType.MouseX:
             SuperInput.SetMouseX(curve.Evaluate((float)playable.GetTime()), this);
             break;
         case DynamicTrackType.MouseY:
             SuperInput.SetMouseY(curve.Evaluate((float)playable.GetTime()), this);
             break;
     }
 }
Example #4
0
 // Called when the state of the playable is set to Paused
 public override void OnBehaviourPause(Playable playable, FrameData info)
 {
     SuperInput.UnsetKey(key, this);
 }