Here is the most important API for controlling cutscenes from your scripts, all being members of the ‘Cutscene’ MonoBehaviour derived class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
//////PROPERTIES/////// ///The current time of the cutscene public float currentTime{get;set} ///The length of the cutscene public float length{get;set} ///Is the cutscene currently playing? public bool isActive{get;} ///Is the cutscene currently paused? public bool isPause{get;} ///The time left before the cutscene ends. public float remainingTime{get;} //////EVENTS/////// ///Raised when a cutscene starts with the argument being that cutscene. public static event Action<Cutscene> OnCutsceneStarted; ///Raised when a cutscene stops with the argument being that cutscene. public static event Action<Cutscene> OnCutsceneStopped; ///Raised when a section has been reached public event Action<Section> OnSectionReached; ///Raised when the Director Group sends a global message (or SendGlobalMessage has been called on the cutscene by some other means) //string: the event name //object: the parameter value public event Action<string, object> OnGlobalMessageSend; //////METHODS/////// ///All the actors this cutscene affects. public IEnumerable<GameObject> GetAffectedActors(); ///Sample the cutscene at specific time. You can call this anytime and without any requirements at all. public void Sample(float time); ///Play the cutscene starting from a specific time public void Play(float startTime = 0); ///Play the cutscene from time, to time, with set wrap mode and direction as well as get a callback for when it ends. public void Play(float startTime, float endTime, WrapMode wrapMode, PlayDirection playDirection, Action callback); ///Play a cutscene by its name. This method first searches in a Resources folder for a cutscene prefab. ///If one is found it is instantiated and played automatically, then destroyed when finished. ///If not then searches for a cutscene with that name in the scene and plays it. public void Play(string name); ///Stop the cutscene using the default StopMode set in its inspector. public void Stop() ///Stop the cutscene using the specified StopMode. public void Stop(StopMode stopMode); ///Shortcut for playing the cutscene in reverse, from endTime to startTime (parameters are inversed). public void PlayReverse(float startTime, float endTime); ///Pause the cutscene. public void Pause(); ///Resume a paused cutscene. public void Resume(); ///Rewind the cutscene and its affected actors state. If the cutscene is running it will also stop. public void Rewind(); ///Completely skip the cutscene. If it's running, it will also stop. public void SkipAll(); ///Skip cutscene time to the next section, or end time if none left. public void SkipCurrentSection(); ///Breaks out of the current Section Loop in case the current Section is looping in the first place. public void BreakSectionLoop(bool alsoSkip = false) { ///Set the cutscene current time to the specified section by name. public void JumpToSection(string name); ///Play the cutscene starting from a specific section by name. public void PlayFromSection(string name); ///Play only the specific section by name. public void PlaySection(string name); ///Set the target actor of a group specified by its name. public void SetGroupActorOfName(string name, GameObject newActor); |