fixed supposed bug

This commit is contained in:
nexovec 2022-01-30 13:23:10 +01:00
parent 83c8aea09b
commit c658282979
1 changed files with 2 additions and 1 deletions

View File

@ -176,10 +176,11 @@ public class PlayerController : MonoBehaviour
}
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.");
rb.velocity = Vector3.zero;
UiController.isInMenu = true;
Physics.gravity = -Vector3.up * 9.81f;
UiController.SaveGame();
UnityEngine.SceneManagement.SceneManager.LoadScene(0);