IEnumerator WinSequence() { p_dive.enabled = false; p_input.enabled = false; p_movement.MovePlayer(1, 1, 1f); yield return(new WaitForSeconds(4f)); p_movement.MovePlayer(new Vector3(0, 0, 60), 5f); cam.FadeToColor(Color.white, 2f); yield return(new WaitForSeconds(2f)); cam.FadeToColor(Color.black, 2f); yield return(new WaitForSeconds(2f)); cam.SetText("the warning reached them in time\nyour home is safe once again"); cam.FadeTextIn(); yield return(new WaitForSeconds(5f)); cam.FadeTextOut(); yield return(new WaitForSeconds(2f)); cam.SetText("press [SPACE] to play again"); cam.FadeToColor(Color.black, 40f); cam.FadeTextIn(); while (true) { if (Input.GetKeyDown(KeyCode.Space)) { break; } yield return(null); } cam.FadeTextOut(); yield return(new WaitForSeconds(1f)); Application.LoadLevel(Application.loadedLevel); }
static IEnumerator TransitionEnvironment(Environment to) { playermoveinput.enabled = false; playerdive.enabled = false; playermove.MovePlayer(1, 1, 1); if (to.environmentHeight) { cam.LookUp(40f); MusicControl.PlayDay(); } else { cam.LookDown(40f); MusicControl.PlayNight(); } ground.GetComponent <ParallaxControl>().ZoomIn(5f); yield return(new WaitForSeconds(1.5f)); playermove.MovePlayer(1, 0, 4); cam.FadeToColor(to.transitionColor, 5f); yield return(new WaitForSeconds(.5f)); cam.LookLevel(40f); yield return(new WaitForSeconds(1f)); playermove.MovePlayer(1, 1, 1); if (to.background != null) { background.gameObject.SetActive(true); background.material.mainTexture = to.background; background.material.color = Color.white; } else { background.gameObject.SetActive(false); } if (to.ground != null) { ground.gameObject.SetActive(true); ground.material.mainTexture = to.ground; ground.material.color = Color.white; } else { ground.gameObject.SetActive(false); } if (to.left != null) { leftside.gameObject.SetActive(true); leftside.material.mainTexture = to.left; } else { leftside.gameObject.SetActive(false); } if (to.right != null) { rightside.gameObject.SetActive(true); rightside.material.mainTexture = to.right; } else { rightside.gameObject.SetActive(false); } ground.GetComponent <ParallaxControl>().ZoomOut(5f); sun.color = to.sunBrightness; cam.FadeToColor(Color.clear, .5f); yield return(new WaitForSeconds(1.5f)); }
// Update is called once per frame void Update() { movement.MovePlayer(1 + (int)Input.GetAxis("Horizontal"), 1 - (int)Input.GetAxis("Vertical")); }