IEnumerator StartBattle() { CameraFX.ZoomIn(1f); yield return(new WaitForSecondsRealtime(0.5f)); CameraFX.FadeIn(); camScript.enabled = false; yield return(new WaitForSecondsRealtime(1f)); CameraFX.ResetRenderScreen(); CameraFX.FadeOut(); camScript.enabled = false; Time.timeScale = 1; BattleScene.instance.StartBattle(); }
IEnumerator Cinematic() { yield return(new WaitForSeconds(1)); CameraFX.Screenshake(1, 0.2f, 0.2f); AudioManager.PlayOneShot(dragonRoarSound); yield return(new WaitForSeconds(1.5f)); CameraFX.FadeSpeed = 2f; CameraFX.FadeIn(); yield return(new WaitForSeconds(1f)); VideoManager.instance.SetVideoClip(clip); VideoManager.instance.Play(); PlayerData.player.controller.enabled = false; while (!VideoManager.instance.IsPlaying()) { yield return(new WaitForSeconds(1f)); } GameManager.PlayCanvas.enabled = false; CameraFX.FadeSpeed = 4f; CameraFX.FadeOut(); while (VideoManager.instance.IsPlaying()) { yield return(new WaitForSeconds(1f)); } for (int i = 0; i < GameManager.PlayCanvas.transform.childCount; i++) { if (GameManager.PlayCanvas.transform.GetChild(i).gameObject.name != "ScreenFade") { GameManager.PlayCanvas.transform.GetChild(i).gameObject.SetActive(false); } } GameManager.PlayCanvas.enabled = true; CameraFX.FadeIn(); yield return(new WaitForSeconds(1f)); VideoManager.instance.Stop(); Destroy(VideoManager.instance.gameObject); AsyncOperation levelLoad = GameManager.instance.loadScene(0); levelLoad.allowSceneActivation = true; }
public IEnumerator Respawn() { CameraFX.FadeIn(); body.velocity = Vector2.zero; yield return(new WaitForSeconds(0.4f)); transform.position = new Vector2(respawnLocation.position.x, respawnLocation.GetComponent <SpriteRenderer>().bounds.max.y); body.velocity = Vector2.zero; jumping = false; melodyData.currentMelody = null; CancelPlayingMelody(); health = 3; respawnLocation.GetComponent <Campfire>().mb.CalculateMapBounds(); respawnLocation.GetComponent <Campfire>().mb.UpdateMapBounds(); Camera.main.GetComponent <CameraFollow2D>().UpdateToMapBounds(); CameraFX.FadeOut(); GameManager.instance.switchState(new PlayState(GameManager.instance)); }
IEnumerator EnterHouse() { if (elevator) { Animator anim = transform.parent.GetComponent <Animator>(); anim.SetTrigger("Open"); StartCoroutine(ElevatorFadePlayer(2)); yield return(new WaitForSeconds(1f)); } CameraFX.FadeIn(); AudioManager.PlayOneShot(audioOnUse); yield return(new WaitForSeconds(1f)); player.transform.position = houseLocation.position; if (elevator) { StopAllCoroutines(); player.GetComponent <SpriteRenderer>().color = Color.white; } if (GetComponent <SpriteRenderer>() != null) // Flip the player sprite if they are entering a house { player.transform.localScale = new Vector3(player.transform.localScale.x * spawnDirection, player.transform.localScale.y, player.transform.localScale.z); } mb.CalculateMapBounds(); mb.UpdateMapBounds(); GameManager.instance.switchState(new TransitionState(GameManager.instance)); CameraFollow2D camScript = Camera.main.GetComponent <CameraFollow2D>(); camScript.enabled = true; camScript.ActivateTransition(); camScript.UpdateToMapBounds(); CameraFX.FadeOut(); }
void SwPlayState() { CameraFX.FadeIn(); Camera.main.GetComponent <AudioSource>().Stop(); GameManager.instance.StartCoroutine(Delay()); }