public IFadeable getFader() { // can't set the reference on Start() because LevelManager also do some stuffs in Start() that depends on this fader component if (fader == null) { FadeColor component = GetComponentInChildren <FadeColor>(); fader = (IFadeable)component.GetComponent(typeof(IFadeable)); } return(fader); }
private void reloadLevel() { // reset and re spawn every actor status ReloadableManager.Instance.reloadActors(); // setup the scene components for the current scene setupSceneActors(); // start camera fade out IFadeable fader = Camera.main.GetComponent <CameraFadeable>().getFader(); fader.startFading(EnumFadeDirection.FADE_OUT); }
public void setFaderFromMainCamera() { // need to find IFadeable component here because main camera instance changes during scenes fader = Camera.main.GetComponent <CameraFadeable>().getFader(); }
// Use this for initialization void Start() { fader = (IFadeable)Camera.main.GetComponentInChildren(typeof(IFadeable)); camFollower = GameObject.FindObjectOfType(typeof(PlayerFollowerXY)) as PlayerFollowerXY; }
//TODO: This cross fade method is deprecated. Delete once no longer in use in Room.cs /// <summary> /// Do not use! Deprecated method, will not do anything.. /// </summary> /// <param name="fadeKey">Key name of the fade to look up.</param> /// <param name="audioTrack">Audio track to fade-in.</param> /// <param name="additionalTracks">Additonal audio tracks to fade-in.</param> public void CrossFade(string fadeKey, IFadeable audioTrack, params IFadeable[] additionalTracks) { /*ChangeAlphaValue tempFade = GetFade(fadeKey); if (tempFade == null) { Debug.Log("Could not find ChangeAlphaValue with that key."); return; } if (FadeOutCurrent != null) FadeOutCurrent.Invoke(tempFade.FadeOutCurve); audioTrack.BeginFade(tempFade.FadeInCurve, false); foreach (var track in additionalTracks) { track.BeginFade(tempFade.FadeInCurve, false); }*/ }
/// <summary> /// Initiates a crossfade of two sound types that are IFadeable. /// </summary> /// <param name="faceOutTrack">Sound that will fade-out.</param> /// <param name="fadeInTrack">Sound that will fade-in.</param> /// <param name="fadeSettings">ChangeAlphaValue type containing the fade curves.</param> private void CrossFade(IFadeable faceOutTrack, IFadeable fadeInTrack, Fade fadeSettings) { faceOutTrack.BeginFade(fadeSettings.FadeOutCurve, true); fadeInTrack.BeginFade(fadeSettings.FadeInCurve, false); }
/// <summary> /// Initiates a cross fade of sound types that are IFadeable. /// </summary> /// <param name="fadeInTracks">Collection of custom sound types to fade in to.</param> /// <param name="fadeKey">The key of the fade used for loading the proper fade setting.</param> /// <param name="fadeOutMusic">Flag used to signal whether currently playing music type should fade out.</param> /// <param name="fadeOutAmbient">Flag used to signal whether currently playing ambient sound type should fade out.</param> /// <param name="fadeOutSfx">Flag used to signal whether currently playing SFXGO sound type should fade out.</param> /// <param name="fadeOutRandomSfx">Flag used to signal whether currently playing Random SFXGO sound type should fade out.</param> public void CrossFade(IFadeable[] fadeInTracks, string fadeKey, bool fadeOutMusic, bool fadeOutAmbient, bool fadeOutSfx, bool fadeOutRandomSfx) { var fadeSetting = GetFade(fadeKey); if (fadeSetting == null) { Debug.Log("fadeSetting is null."); return; } if (fadeOutMusic) { if (FadeOutMusic != null) FadeOutMusic.Invoke(fadeSetting.FadeOutCurve); } if (fadeOutAmbient) { if (FadeOutAmbient != null) FadeOutAmbient.Invoke(fadeSetting.FadeOutCurve); } if (fadeOutSfx) { if (FadeOutSFX != null) FadeOutSFX.Invoke(fadeSetting.FadeOutCurve); } if (fadeOutRandomSfx) { if (FadeOutRandomSFX != null) FadeOutRandomSFX.Invoke(fadeSetting.FadeOutCurve); } foreach (var fadeInTrack in fadeInTracks) { fadeInTrack.BeginFade(fadeSetting.FadeInCurve, false); } }