Beispiel #1
0
    private void Awake()
    {
        PlayerPointScript PPS = GameObject.FindGameObjectWithTag("PlayerPoints").GetComponent <PlayerPointScript>();

        for (int i = 0; i < transform.childCount; i++)
        {
            transform.GetChild(i).GetComponent <Text>().text = PPS.GetTrackAndPos(i);
        }
    }
Beispiel #2
0
    private void Awake()
    {
        try
        {
            PlayerPoints = GameObject.FindGameObjectWithTag("PlayerPoints").GetComponent <PlayerPointScript>();
        }
        catch
        {
            Debug.Log("Level Played Out Of Order");
        }

        GameObject[] KartsList = GameObject.FindGameObjectsWithTag("Kart");
        Players = new Kart[KartsList.Length];
        for (int j = 0; j < KartsList.Length; j++)
        {
            Players[j] = KartsList[j].gameObject.GetComponent <Kart>();
        }

        foreach (Kart p in Players)
        {
            PlayerPositions.Add(p.GetName(), 0);
            if (p.GetName() == "Player")
            {
                PCKart = p;
            }
        }

        CheckPointScript[] CheckpointArray = GetComponentsInChildren <CheckPointScript>();
        NumberOfCheckpoints = CheckpointArray.Length;
        CheckPointLocations = new Vector3[CheckpointArray.Length];
        int i = 0;

        foreach (CheckPointScript Checkpoint in CheckpointArray)
        {
            Checkpoint.SetUpPosition(i, this);
            CheckPointLocations[i] = Checkpoint.gameObject.transform.position;
            i++;
        }

        FinalPositions = new string [KartsList.Length];
        for (int k = 0; k < FinalPositions.Length; k++)
        {
            FinalPositions[k] = "NA";
        }
    }
Beispiel #3
0
    public void ChangeBarValues(string[,] IncPositions, PlayerPointScript IncPPS)
    {
        PlayerPrefs.SetInt("RACES_COMPLETE", (PlayerPrefs.GetInt("RACES_COMPLETE") + 1));
        Array.Reverse(BarArray);
        PPS = IncPPS;
        int j = 0;
        int q = 9;

        foreach (PositionBarScript i in BarArray)
        {
            i.SetUpBar(q.ToString(), IncPositions[j, 0], IncPositions[j, 1]);
            j++;
            q--;
            //The array is reversed but the 2d incoming array isn't
            //Simplest solution to the problem is two ints
        }
        ParentCanvas.enabled = true;
        Waiting = true;
    }