/** * <summary>Creates a new instance of the 'Sound: Play ambience' Action, set to resume the last-played track</summary> * <param name = "transitionTime">The time, in seconds, over which to start fully playing the track</param> * <param name = "doRestart">If True, the track will play from the beginning</param> * <param name = "waitUntilFinish">If True, then the Action will wait until the transition is complete</param> * <returns>The generated Action</returns> */ public static ActionAmbience CreateNew_ResumeLastTrack(float transitionTime = 0f, bool doRestart = false, bool waitUntilFinish = false) { ActionAmbience newAction = (ActionAmbience)CreateInstance <ActionAmbience>(); newAction.musicAction = MusicAction.ResumeLastStopped; newAction.fadeTime = transitionTime; newAction.resumeFromStart = doRestart; newAction.willWaitComplete = waitUntilFinish; return(newAction); }
/** * <summary>Creates a new instance of the 'Sound: Play ambience' Action, set to play a new track</summary> * <param name = "trackID">The ambience track ID</param> * <param name = "loop">If True, then the new track will be looped</param> * <param name = "addToQueue">If True, then the new track will be added to the current queue, as opposed to played immediately</param> * <param name = "transitionTime">The time, in seconds, over which to start fully playing the new track</param> * <param name = "doCrossfade">If True, and transitionTime > 0, then the new track will crossfade with any existing track - as opposed to fading out then fading in separately</param> * <param name = "waitUntilFinish">If True, then the Action will wait until the transition is complete</param> * <returns>The generated Action</returns> */ public static ActionAmbience CreateNew_Play(int trackID, bool loop = true, bool addToQueue = false, float transitionTime = 0f, bool doCrossfade = false, bool waitUntilFinish = false) { ActionAmbience newAction = (ActionAmbience)CreateInstance <ActionAmbience>(); newAction.musicAction = doCrossfade ? MusicAction.Crossfade : MusicAction.Play; newAction.trackID = trackID; newAction.loop = loop; newAction.isQueued = addToQueue; newAction.fadeTime = transitionTime; newAction.willWait = waitUntilFinish; return(newAction); }