private IEnumerator Start() { var loadUIScene = SceneManager.LoadSceneAsync(3, LoadSceneMode.Additive); player = PlayerActor.Instance; yield return(null); // wait for first frame while (!loadUIScene.isDone) { yield return(null); } yield return(CameraFadeScript.FadeIn(1.4f)); yield return(Tick()); }
private async Task Respawn() { this.gameObject.SetActive(false); await CameraFadeScript.FadeOut(0.1f).ToObservable(); this.stats.currentStats.hp = this.stats.attributes.attributes.hp; this.transform.position = GridUtil.GridToWorld(GameTickManager.Instance.ActiveRoom.playerEnterTile); this.movementController.ResetDesiredPosition(); foreach (var activeEnemy in GameTickManager.Instance.activeEnemies) { activeEnemy.DoCalm(); } this.gameObject.SetActive(true); await CameraFadeScript.FadeIn(1.2f).ToObservable(); }
/// <summary> /// Applies a fade effect to the camera. /// </summary> /// <param name="cam">Camera.</param> /// <param name="initialValue">Initial fade value.</param> /// <param name="toFadeValue">Final fade value.</param> /// <param name="duration">Fade duration.</param> /// <param name="color">Fade color.</param> /// <param name="endAction">Action to invoke when fade completes.</param> /// <param name="cancelAction">Action to invoke if fade is canceled.</param> private void FadeCamera(Camera cam, float initialValue, float toFadeValue, float duration, Color color, System.Action endAction = null, System.Action cancelAction = null) { CameraFadeScript fader = cam.gameObject.GetComponent <CameraFadeScript>(); if (fader == null) { fader = cam.gameObject.AddComponent <CameraFadeScript>(); } if (fader.IsFading) { fader.CancelAndBeginNewFade(fader.FadeValue, toFadeValue, color, duration, endAction, cancelAction); } else { fader.BeginFade(initialValue, toFadeValue, color, duration, endAction, cancelAction); } }
void Awake() { var x = CameraFadeScript.SetupCameraFade(); x.intensity = 1; }
public static CameraFadeScript GetInstance() { CameraFadeScript cfs = GameObject.Find("CameraFade").GetComponent <CameraFadeScript>(); return(cfs); }