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); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "LandingZone") //Checks collision with the landing zones { if (LevelManager.Get().ReturnVVel() * 20 > -4) //If speed is too high, crushes { LevelManager.Get().AddScore(); LevelManager.Get().LandedScreen(); //Loads landing screen } else { LevelManager.Get().CrushedScreen(); } } if (collision.gameObject.tag == "Terrain") //Collision with terrain = crush { LevelManager.Get().CrushedScreen(); } if (collision.gameObject.tag == "CameraZoomCheck") //when to zoom in { CameraZoom.Get().DoZoom(); } }
private void OnTriggerEnter2D(Collider2D collision) //Players collisions { if (collision.gameObject.tag == "LandingZone") { LevelManager.Get().CrushedScreen(); } if (collision.gameObject.tag == "Terrain") { LevelManager.Get().CrushedScreen(); } if (collision.gameObject.tag == "CameraZoomCheck") { CameraZoom.Get().DoZoom(); Destroy(collision); } }