Game Manager WIP

This commit is contained in:
2024-04-24 08:53:46 +02:00
parent ccd2ea506b
commit 7b313fe2d4
14 changed files with 373 additions and 473 deletions

View File

@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class GameManager : MonoBehaviour
@@ -8,10 +9,16 @@ public class GameManager : MonoBehaviour
public GameObject[] checkpoints;
public GameObject[] players;
int currentLap = 1;
int[] playerLaps;
void Start()
{
// reset laps
playerLaps = new int[players.Count()];
for (int i = 0; i < playerLaps.Count(); i++)
{
playerLaps[i] = 1;
}
}
// Update is called once per frame
@@ -19,7 +26,14 @@ public class GameManager : MonoBehaviour
{
foreach (GameObject player in players)
{
try
{
int checkpointsCollected = player.GetComponent<PlayerController>().checkpointsCollected;
}
catch
{
int checkpointsCollected = player.GetComponent<AgentController>().checkpointsCollected;
}
}
}
}