40 lines
902 B
C#
40 lines
902 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
public class GameManager : MonoBehaviour
|
|
{
|
|
public int lapAmount;
|
|
public GameObject[] checkpoints;
|
|
public GameObject[] players;
|
|
|
|
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
|
|
void Update()
|
|
{
|
|
foreach (GameObject player in players)
|
|
{
|
|
try
|
|
{
|
|
int checkpointsCollected = player.GetComponent<PlayerController>().checkpointsCollected;
|
|
}
|
|
catch
|
|
{
|
|
int checkpointsCollected = player.GetComponent<AgentController>().checkpointsCollected;
|
|
}
|
|
}
|
|
}
|
|
}
|