Tanoda
SetPlayableDirector.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
9using System.Collections;
10using System.Collections.Generic;
11using UnityEngine;
12using UnityEngine.Playables;
13
14namespace Leap.Unity.Recording {
15 using Animation;
16
17 public class SetPlayableDirector : MonoBehaviour {
18
19 #pragma warning disable 0649
20 [SerializeField]
21 private PlayableDirector _director;
22
23 [SerializeField]
24 private PlayableAsset _playable;
25
26 [SerializeField]
27 private DirectorWrapMode _wrapMode = DirectorWrapMode.None;
28 #pragma warning restore 0649
29
30 private void OnEnable() {
31 _director.time = 0;
32 _director.extrapolationMode = _wrapMode;
33 _director.Play(_playable);
34 }
35
36 public void PauseAndHold() {
37 _director.playableGraph.GetRootPlayable(0).SetSpeed(0);
38 }
39
40 public void ResumeFromPauseAndHold() {
41 _director.playableGraph.GetRootPlayable(0).SetSpeed(1);
42 }
43 }
44}