Beispiel #1
0
    IEnumerator LoadLevelAfterTime(float time) // Time to wait between loading screen and next level
    {
        yield return(new WaitForSeconds(time));

        SceneManager.LoadScene("Game");
        ScreenLevel.Get().LoadingScreenOnOff();
    }
 public void NextLevel() //Sets up loading screen
 {
     level++;
     ScreenLevel.Get().GetLevelNumber(level);
     ScreenLevel.Get().LoadingScreenOnOff();
     ScreenLevel.Get().InLoadingScreen();
     StartCoroutine(LoadLevelAfterTime(3));
 }
    void Update()
    {
        LevelManager.Get().GetVVel(rig.velocity.y);
        LevelManager.Get().GetHVel(rig.velocity.x);
        LevelManager.Get().GetAltitude(this.transform.position.y);
        CameraZoom.Get().GetPlayerPos(this.transform.position);
        //Player movement and conditions when to move
        if (PauseManager.Get().GetPause() == true || PauseManager.Get().GetHasLanded() == true || PauseManager.Get().GetHasCrushed() == true || ScreenLevel.Get().GetOnLoadingScreen() == true)
        {
            rig.simulated = false;
        }
        else
        {
            rig.simulated = true;
            if (Input.GetKey(KeyCode.Space))
            {
                rig.AddForce(transform.up * thrust * Time.deltaTime);
                if (Time.timeScale == 1)
                {
                    LevelManager.Get().LoseFuel();
                }
            }

            if (Input.GetKey(KeyCode.LeftArrow))
            {
                transform.Rotate(Vector3.forward * rotationSpeed * Time.deltaTime);
            }
            if (Input.GetKey(KeyCode.RightArrow))
            {
                transform.Rotate(Vector3.back * rotationSpeed * Time.deltaTime);
            }
        }
    }