static public int TransitionTo(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.Audio.AudioMixerSnapshot self = (UnityEngine.Audio.AudioMixerSnapshot)checkSelf(l); System.Single a1; checkType(l, 2, out a1); self.TransitionTo(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
private void UnPause() { Time.timeScale = 1; current = levelMusic; LevelMusicSource.UnPause(); current.TransitionTo(TransitionSeconds); StartCoroutine(PauseMusic(PauseMusicSource, current, TransitionSeconds * TimeWarpingFactor)); }
private void TransitionToSnapshot(AudioMixerSnapshot snapshot, float timeToReach) { if ((UnityEngine.Object) snapshot == (UnityEngine.Object) null) throw new ArgumentException("null Snapshot passed to AudioMixer.TransitionToSnapshot of AudioMixer '" + this.name + "'"); if ((UnityEngine.Object) snapshot.audioMixer != (UnityEngine.Object) this) throw new ArgumentException("Snapshot '" + snapshot.name + "' passed to AudioMixer.TransitionToSnapshot is not a snapshot from AudioMixer '" + this.name + "'"); snapshot.TransitionTo(timeToReach); }
private void TransitionToSnapshot(AudioMixerSnapshot snapshot, float timeToReach) { if (snapshot == null || snapshot.audioMixer != this) { return; } snapshot.TransitionTo(timeToReach); }
private void Pause() { Time.timeScale = TimeWarpingFactor; current = pauseMusic; PauseMusicSource.UnPause(); current.TransitionTo(TransitionSeconds * TimeWarpingFactor); StartCoroutine(RepauseLater(TransitionSeconds * TimeWarpingFactor)); StartCoroutine(PauseMusic(LevelMusicSource, current, TransitionSeconds * TimeWarpingFactor)); }
// Update is called once per frame void Update() { if (AIBlackboard.instance.PlayerNearEnemy(60)) { battleSnapshot.TransitionTo(1f); } else { normalSnapshot.TransitionTo(2.8f); } }
// Use this for initialization void Start() { myAudioMixer.SetFloat("sfxVol",0.75f); myAudioMixer.SetFloat("musicVol",0.75f); mainCam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>(); myRewindSound = this.gameObject.GetComponent<AudioSource>(); RewindSnap = myAudioMixer.FindSnapshot("Rewind"); NormalSnap = myAudioMixer.FindSnapshot("Normal"); NormalSnap.TransitionTo(.5f); StartCoroutine("record"); }
private void TransitionToSnapshot(AudioMixerSnapshot snapshot, float timeToReach) { if (snapshot == null) { throw new ArgumentException("null Snapshot passed to AudioMixer.TransitionToSnapshot of AudioMixer '" + base.name + "'"); } if (snapshot.audioMixer != this) { string[] textArray1 = new string[] { "Snapshot '", snapshot.name, "' passed to AudioMixer.TransitionToSnapshot is not a snapshot from AudioMixer '", base.name, "'" }; throw new ArgumentException(string.Concat(textArray1)); } snapshot.TransitionTo(timeToReach); }
static public int TransitionTo(IntPtr l) { try { UnityEngine.Audio.AudioMixerSnapshot self = (UnityEngine.Audio.AudioMixerSnapshot)checkSelf(l); System.Single a1; checkType(l, 2, out a1); self.TransitionTo(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int TransitionTo(IntPtr l) { try { UnityEngine.Audio.AudioMixerSnapshot self = (UnityEngine.Audio.AudioMixerSnapshot)checkSelf(l); System.Single a1; checkType(l, 2, out a1); self.TransitionTo(a1); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
public void Transition(int music) { if (music == 1) { snapshot = snapshotTitle; snapshot.TransitionTo (1.5f); } else if (music == 2) { snapshot = snapshotCastle; snapshot.TransitionTo (1.5f); } else if (music == 3) { snapshot = snapshotWin; snapshot.TransitionTo (1.5f); } else if (music == 4) { snapshot = snapshotDeath; snapshot.TransitionTo (1.5f); } }
public void SetCameraView(CameraView newView) { // Debug.Log("Setting camera view: " + cameraView + " -> " + newView); /* Debug.Log("SETTING " + cameraView + " " + newView); * if (cameraView == newView) * { * return; * } * Debug.Log("continuing..."); */ // Guard against switching to actor-driven camera when there is no camera actor. // Shouldn't happen, but just to be safe. if (newView == CameraView.ActorDriven && actorDrivenCameraViewController.GetCameraActor() == null) { Debug.LogWarning("Can't switch to actor-driven camera. No camera actor."); return; } CameraView oldView = cameraView; CameraViewController oldController = cameraViewController; cameraView = newView; gbStage.SetInitialCameraMode((GameBuilderStage.CameraMode)cameraView); // Log how long user spent in previous mode if (lastSwitchTime > 0f) { float secondsSpent = Time.realtimeSinceStartup - lastSwitchTime; long msSpent = (long)(Mathf.FloorToInt(secondsSpent * 1000f)); if (msSpent > 100) { Util.Log($"Spent {msSpent}ms in {oldView.ToString()}"); } } lastSwitchTime = Time.realtimeSinceStartup; switch (cameraView) { case CameraView.ThirdPerson: cameraViewController = thirdPersonCameraViewController; break; case CameraView.FirstPerson: cameraViewController = fpsCameraViewController; break; case CameraView.Isometric: cameraViewController = isometricCameraViewController; break; case CameraView.ActorDriven: cameraViewController = actorDrivenCameraViewController; break; default: throw new System.Exception($"Unsupported CameraView: {cameraView}"); } cameraViewController.SetCamera(); if ((cameraView == CameraView.FirstPerson || cameraView == CameraView.ThirdPerson) && (oldView == CameraView.FirstPerson || oldView == CameraView.ThirdPerson) && oldController != null) { cameraViewController.SetLookRotation(oldController.GetLookRotation()); } if (cameraView == CameraView.Isometric) { distantAudioMixSnapshot.TransitionTo(.1f); } else { closeAudioMixSnapshot.TransitionTo(.1f); } }
public void FadeMusic(AudioMixerSnapshot snap, float duration) { if (snap != null) { snap.TransitionTo(duration); } }
//Created this function to use to transition to various snapshots public void ToSnapshot(AudioMixerSnapshot snapshot, float time) { snapshot.TransitionTo (time); }