コード例 #1
0
 public void OnNotify(Playable origin, INotification notification)
 {
     if (director == null)
     {
         Awake();
     }
     if (notification is JumpSignalEmmiter)
     {
         JumpSignalEmmiter signal = notification as JumpSignalEmmiter;
         director.time = signal.jumpTime;
     }
     else if (notification is SlowSignalEmitter)
     {
         SlowSignalEmitter signal = notification as SlowSignalEmitter;
         director.playableGraph.GetRootPlayable(0).SetSpeed(signal.slowRate);
     }
     else if (notification is ActiveSignalEmmiter)
     {
         ActiveSignalEmmiter signal = notification as ActiveSignalEmmiter;
         TrackAsset          track  = TimelineUtil.GetRootTrack(signal);
         Transform           tf     = ExternalHelp.FetchAttachOfTrack(director, track);
         if (tf)
         {
             tf.gameObject.SetActive(signal.Active);
         }
     }
 }
コード例 #2
0
 void Update()
 {
     if (Input.GetKeyUp(KeyCode.Space))
     {
         director.Stop();
         director.time = 0d;
         director.Play();
     }
     if (Input.GetKeyUp(KeyCode.F1))
     {
         var output             = ScriptPlayableOutput.Create(director.playableGraph, "");
         JumpSignalEmmiter sign = ScriptableObject.CreateInstance <JumpSignalEmmiter>();
         sign.jumpTime = 0;
         output.PushNotification(Playable.Null, sign);
     }
     if (Input.GetKeyUp(KeyCode.F3))
     {
         director.Pause();
         backward = true;
     }
     if (Input.GetKeyUp(KeyCode.F4))
     {
         backward = false;
         director.Play();
     }
     if (backward)
     {
         director.time = director.time - Time.deltaTime;
         director.Evaluate();
     }
 }
コード例 #3
0
ファイル: TimelineEntry.cs プロジェクト: sebjf/timeline-1
 void Update()
 {
     if (Input.GetKeyUp(KeyCode.F1))
     {
         var output = ScriptPlayableOutput.Create(director.playableGraph, "");
         output.AddNotificationReceiver(this);
         JumpSignalEmmiter sign = ScriptableObject.CreateInstance <JumpSignalEmmiter>();
         sign.jumpTime = 0;
         output.PushNotification(Playable.Null, sign);
     }
 }
コード例 #4
0
ファイル: TimelineEntry.cs プロジェクト: sebjf/timeline-1
 public void OnNotify(Playable origin, INotification notification, object context)
 {
     if (notification is JumpSignalEmmiter)
     {
         JumpSignalEmmiter signal = notification as JumpSignalEmmiter;
         director.time = signal.jumpTime;
     }
     else if (notification is SlowSignalEmitter)
     {
         SlowSignalEmitter signal = notification as SlowSignalEmitter;
         director.playableGraph.GetRootPlayable(0).SetSpeed(signal.slowRate);
     }
 }