Game manager WIP

This commit is contained in:
2024-04-24 07:56:29 +02:00
parent 20cbc182ac
commit ccd2ea506b
14 changed files with 426 additions and 188 deletions

View File

@@ -9,14 +9,12 @@ public class PlayerController : MonoBehaviour
public float maxSpeed = 20;
public float steeringRange = 30;
public float steeringRangeAtMaxSpeed = 10;
public float autoBrake;
//public GameObject lookat;
public AudioSource audio;
WheelControl[] wheels;
public Rigidbody rigidBody;
[HideInInspector] public int checkpointsCollected = 0;
public GameObject[] checkpoints;
// Start is called before the first frame update
void Start()
@@ -123,7 +121,6 @@ public class PlayerController : MonoBehaviour
}
private void OnCollisionEnter(Collision other) {
if (other.gameObject.tag == "Wall")
@@ -131,4 +128,14 @@ public class PlayerController : MonoBehaviour
// audio.Play();
}
}
private void OnTriggerEnter(Collider other) {
print(checkpointsCollected);
Transform currentCheckpoint = checkpoints[checkpointsCollected].transform;
if (other.gameObject == currentCheckpoint)
{
checkpointsCollected += 1;
print(checkpointsCollected);
}
}
}