L
This commit is contained in:
@@ -8,6 +8,7 @@ public class GameManager : MonoBehaviour
|
||||
public int lapAmount;
|
||||
public GameObject[] checkpoints;
|
||||
public GameObject[] players;
|
||||
[HideInInspector] public string[] playersFinished;
|
||||
|
||||
int[] playerLaps;
|
||||
void Start()
|
||||
@@ -28,6 +29,9 @@ public class GameManager : MonoBehaviour
|
||||
{
|
||||
GameObject player = players[i];
|
||||
|
||||
if (playersFinished.Contains(player.name))
|
||||
continue;
|
||||
|
||||
bool isAI = true;
|
||||
if (player.GetComponent<PlayerController>().enabled)
|
||||
isAI = false;
|
||||
@@ -56,8 +60,12 @@ public class GameManager : MonoBehaviour
|
||||
if (playerLaps[i] > lapAmount)
|
||||
{
|
||||
player.GetComponent<Rigidbody>().isKinematic = true;
|
||||
}
|
||||
playersFinished.Append(player.name);
|
||||
|
||||
print("\nPlayers finished:");
|
||||
foreach (string pp in playersFinished)
|
||||
print(pp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,13 +122,13 @@ public class PlayerController : MonoBehaviour
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
// Transform currentCheckpoint = checkpoints[checkpointsCollected].transform;
|
||||
// float checkpintDistance = distanceToCheckpoint(currentCheckpoint);
|
||||
Transform currentCheckpoint = checkpoints[checkpointsCollected].transform;
|
||||
float checkpintDistance = distanceToCheckpoint(currentCheckpoint);
|
||||
|
||||
// if (checkpintDistance < 0.1f)
|
||||
// {
|
||||
// checkpointsCollected += 1;
|
||||
// }
|
||||
if (checkpintDistance < 0.1f)
|
||||
{
|
||||
checkpointsCollected += 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision other) {
|
||||
|
||||
Reference in New Issue
Block a user