Example #1
0
        /**
         * <summary>Creates a new instance of the 'Sound: Play ambience' Action, set to stop the current track</summary>
         * <param name = "transitionTime">The time, in seconds, over which to fade out the track</param>
         * <param name = "waitUntilFinish">If True, then the Action will wait until the transition is complete</param>
         * <returns>The generated Action</returns>
         */
        public static ActionMusic CreateNew_Stop(float transitionTime = 0f, bool waitUntilFinish = false)
        {
            ActionMusic newAction = (ActionMusic)CreateInstance <ActionMusic>();

            newAction.musicAction = MusicAction.Stop;
            newAction.fadeTime    = transitionTime;
            newAction.willWait    = waitUntilFinish;
            return(newAction);
        }
Example #2
0
        /**
         * <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 ActionMusic CreateNew_ResumeLastTrack(float transitionTime = 0f, bool doRestart = false, bool waitUntilFinish = false)
        {
            ActionMusic newAction = (ActionMusic)CreateInstance <ActionMusic>();

            newAction.musicAction      = MusicAction.ResumeLastStopped;
            newAction.fadeTime         = transitionTime;
            newAction.resumeFromStart  = doRestart;
            newAction.willWaitComplete = waitUntilFinish;
            return(newAction);
        }
Example #3
0
        /**
         * <summary>Creates a new instance of the 'Sound: Play music' Action, set to play a new track</summary>
         * <param name = "trackID">The music 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 ActionMusic CreateNew_Play(int trackID, bool loop = true, bool addToQueue = false, float transitionTime = 0f, bool doCrossfade = false, bool waitUntilFinish = false)
        {
            ActionMusic newAction = (ActionMusic)CreateInstance <ActionMusic>();

            newAction.musicAction = doCrossfade ? MusicAction.Crossfade : MusicAction.Play;
            newAction.trackID     = trackID;
            newAction.loop        = loop;
            newAction.isQueued    = addToQueue;
            newAction.fadeTime    = transitionTime;
            newAction.willWait    = waitUntilFinish;
            return(newAction);
        }