Merge branch 'main' of https://git.steelants.cz/GJP/GGJ2022
This commit is contained in:
@@ -4,7 +4,7 @@ using UnityEngine;
|
||||
|
||||
public class PlayerController : MonoBehaviour
|
||||
{
|
||||
public float maxDistanceFromCenterLine;
|
||||
public float maxDistanceFromCenterLine = 30.0f;
|
||||
[Header("Move")]
|
||||
public float speed = 7.5f;
|
||||
public float maxSpeed = 15.0f;
|
||||
@@ -193,7 +193,6 @@ public class PlayerController : MonoBehaviour
|
||||
Debug.Log("Player fell out of map.");
|
||||
rb.velocity = Vector3.zero;
|
||||
Physics.gravity = -Vector3.up * 9.81f;
|
||||
|
||||
UnityEngine.SceneManagement.SceneManager.LoadScene(0);
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ public class ProceduralGeneration : MonoBehaviour
|
||||
if (renderers.Length > 0)
|
||||
{
|
||||
Bounds bounds = renderers[0].bounds;
|
||||
for (int i = 1, ni = renderers.Length; i < ni; i++)
|
||||
for (int i = 0; i < renderers.Length; i++)
|
||||
{
|
||||
bounds.Encapsulate(renderers[i].bounds);
|
||||
}
|
||||
@@ -32,13 +32,14 @@ public class ProceduralGeneration : MonoBehaviour
|
||||
{
|
||||
return new Bounds();
|
||||
}
|
||||
|
||||
}
|
||||
GameObject drawPlatform(GameObject lastObject, GameObject objToSpawn, GameObject parentLevelObject)
|
||||
{
|
||||
Bounds bounds = this.getPrefabBounds(lastObject);
|
||||
Bounds b = new Bounds(bounds.center, bounds.size);
|
||||
|
||||
Vector3 nextBlockLocation = new Vector3(lastObject.transform.position.x, lastObject.transform.position.y, lastObject.transform.position.z + b.size.z + 1.0f);
|
||||
Vector3 nextBlockLocation = new Vector3(lastObject.transform.position.x, lastObject.transform.position.y, lastObject.transform.position.z + b.size.z);
|
||||
|
||||
GameObject newObject = Instantiate(objToSpawn, nextBlockLocation, (Quaternion.identity));
|
||||
newObject.transform.parent = parentLevelObject.transform;
|
||||
@@ -60,7 +61,7 @@ public class ProceduralGeneration : MonoBehaviour
|
||||
Bounds bounds = this.getPrefabBounds(lastObject);
|
||||
Bounds b = new Bounds(bounds.center, bounds.size);
|
||||
|
||||
Vector3 centerPoint = new Vector3(lastObject.transform.position.x, (lastObject.transform.position.y + radius), lastObject.transform.position.z + b.size.z + 1.0f);
|
||||
Vector3 centerPoint = new Vector3(lastObject.transform.position.x, (lastObject.transform.position.y + radius), lastObject.transform.position.z + b.size.z);
|
||||
|
||||
float heightOffset = radius;
|
||||
|
||||
|
@@ -8,6 +8,7 @@ public class UiController : MonoBehaviour
|
||||
public GameObject player = null;
|
||||
private float startPosition;
|
||||
public TextMeshProUGUI uiDistance;
|
||||
public int highScore;
|
||||
public float distance = 0.0f;
|
||||
private float oldDistance = 0.0f;
|
||||
|
||||
@@ -17,6 +18,27 @@ public class UiController : MonoBehaviour
|
||||
startPosition = this.player.transform.position.z;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
|
||||
this.LoadGame();
|
||||
}
|
||||
void SaveGame()
|
||||
{
|
||||
PlayerPrefs.SetInt("HighestScore", this.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
|
||||
|
Reference in New Issue
Block a user