fixed maxDistanceFromCenterLine
This commit is contained in:
parent
733ce0eafb
commit
015cefe9b7
@ -4,7 +4,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class PlayerController : MonoBehaviour
|
public class PlayerController : MonoBehaviour
|
||||||
{
|
{
|
||||||
public float maxDistanceFromCenterLine;
|
public float maxDistanceFromCenterLine = 30.0f;
|
||||||
[Header("Move")]
|
[Header("Move")]
|
||||||
public float speed = 7.5f;
|
public float speed = 7.5f;
|
||||||
public float maxSpeed = 15.0f;
|
public float maxSpeed = 15.0f;
|
||||||
@ -167,7 +167,6 @@ public class PlayerController : MonoBehaviour
|
|||||||
Debug.Log("Player fell out of map.");
|
Debug.Log("Player fell out of map.");
|
||||||
rb.velocity = Vector3.zero;
|
rb.velocity = Vector3.zero;
|
||||||
Physics.gravity = -Vector3.up * 9.81f;
|
Physics.gravity = -Vector3.up * 9.81f;
|
||||||
|
|
||||||
UnityEngine.SceneManagement.SceneManager.LoadScene(0);
|
UnityEngine.SceneManagement.SceneManager.LoadScene(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ public class UiController : MonoBehaviour
|
|||||||
public GameObject player = null;
|
public GameObject player = null;
|
||||||
private float startPosition;
|
private float startPosition;
|
||||||
public TextMeshProUGUI uiDistance;
|
public TextMeshProUGUI uiDistance;
|
||||||
|
public int highScore;
|
||||||
public float distance = 0.0f;
|
public float distance = 0.0f;
|
||||||
private float oldDistance = 0.0f;
|
private float oldDistance = 0.0f;
|
||||||
|
|
||||||
@ -17,6 +18,27 @@ public class UiController : MonoBehaviour
|
|||||||
startPosition = this.player.transform.position.z;
|
startPosition = this.player.transform.position.z;
|
||||||
Cursor.lockState = CursorLockMode.None;
|
Cursor.lockState = CursorLockMode.None;
|
||||||
Cursor.visible = true;
|
Cursor.visible = true;
|
||||||
|
|
||||||
|
PlayerController.LoadSave();
|
||||||
|
}
|
||||||
|
static void SaveGame()
|
||||||
|
{
|
||||||
|
PlayerPrefs.SetInt(PlayerController.highScore);
|
||||||
|
PlayerPrefs.Save();
|
||||||
|
Debug.Log("Game data saved!");
|
||||||
|
}
|
||||||
|
void LoadGame()
|
||||||
|
{
|
||||||
|
if (PlayerPrefs.HasKey("HighestScore"))
|
||||||
|
{
|
||||||
|
this.highScore = PlayerPrefs.GetInt("SavedInteger");
|
||||||
|
Debug.Log("Game data loaded!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.highScore = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
Loading…
Reference in New Issue
Block a user