fixed supposed bug

This commit is contained in:
nexovec 2022-01-30 13:23:10 +01:00
parent 83c8aea09b
commit c658282979

View File

@ -176,10 +176,11 @@ public class PlayerController : MonoBehaviour
} }
var distanceFromYAxis = new Vector2(rb.position.x, rb.position.y).magnitude; var distanceFromYAxis = new Vector2(rb.position.x, rb.position.y).magnitude;
if (distanceFromYAxis > this.maxDistanceFromCenterLine) if (UiController.isInMenu == false && distanceFromYAxis > this.maxDistanceFromCenterLine)
{ {
Debug.Log("Player fell out of map."); Debug.Log("Player fell out of map.");
rb.velocity = Vector3.zero; rb.velocity = Vector3.zero;
UiController.isInMenu = true;
Physics.gravity = -Vector3.up * 9.81f; Physics.gravity = -Vector3.up * 9.81f;
UiController.SaveGame(); UiController.SaveGame();
UnityEngine.SceneManagement.SceneManager.LoadScene(0); UnityEngine.SceneManagement.SceneManager.LoadScene(0);