Exemplo n.º 1
0
    public void Init()
    {
        gameObject.SetActive(true);

        CarInfoParent.DestroyChildren();

        lapTracker = Track.Instance.LapTracker;
        track      = Track.Instance;

        MapName.text   = track.Metadata.Name;
        LapRecord.text = "TR: " + TimeSpan.FromSeconds(track.Metadata.TrackRecord).GetTimeInMinutesAndSeconds();

        carInfoUIs = new List <CarInfo>();

        foreach (var car in lapTracker.CarOrder)
        {
            var obj = Instantiate(CarLapInfoPrefab) as GameObject;
            carInfoUIs.Add(obj.GetComponent <CarInfo>());

            obj.GetComponent <RectTransform>().SetParent(CarInfoParent, true);
            obj.GetComponent <RectTransform>().sizeDelta = new Vector2(CarInfoParent.rect.width / lapTracker.CarOrder.Count, 0);

            obj.GetComponent <CarInfo>().Init(car);
        }
    }
Exemplo n.º 2
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            LapTracker.updateLap();
            return;
        }

        if (other.tag == "ghost")
        {
            ghostLapTracker.updateLap();
            return;
        }

        if (other.tag == "cpu")
        {
            other.GetComponent <resetCPUposition>().updateWaypoint(0, position, rotation);
        }
    }
Exemplo n.º 3
0
 public static void setPlayerPosition(int pos)
 {
     LapTracker.updatePosition(pos);
 }