Game manager WIP
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user