Beispiel #1
0
    private void UpdateRaceCarsJson()
    {
        Vector3    tmpVector3;
        PGTSession theSession = displayManager.currentScene.pointsGTData;
        int        plc        = 0;

        multiplier2 = (multiplier1 / maxPoints);
        if (theSession.playerListJson != null)
        {
            //theSession.playerListJson.RandomizeTrack();
            theSession.playerListJson = theSession.sortlist(theSession.playerListJson);
            winningCars[0].GetComponent <RaceCar>()
            .setName(truncateName(theSession.playerListJson[0].PlayerName));
            winningCars[1].GetComponent <RaceCar>()
            .setName(truncateName(theSession.playerListJson[1].PlayerName));
            winningCars[2].GetComponent <RaceCar>()
            .setName(truncateName(theSession.playerListJson[2].PlayerName));

            //playSound(0);
            RaceCar    currentCar;
            PGTSession currentSession;
            foreach (GameObject car in Cars)
            {
                pgtPlayer tmpCar = theSession.playerListJson[plc];
                //pgtPlayer tmpCar = theSession.playerlist.getCarByTrackLocation(plc);
                if (plc < 10)
                {
                    tmpVector3 = car.transform.localPosition;
                    //tmpVector3.y = (multiplier2*   Points[plc])*DayOfSession;
                    currentSession = displayManager.currentScene.pointsGTData;
                    currentCar     = car.GetComponent <RaceCar>();
                    if (tmpCar.Points != 0)
                    {
                        tmpVector3.y = ((multiplier2 * tmpCar.Points) *
                                        displayManager.currentScene.pointsGTData.DayOfSession);

                        //StartCoroutine(car.GetComponent<RaceCar>().moveCar(tmpVector3, 2f));
                        currentCar.startMove(tmpVector3);
                    }
                    currentCar.setName(truncateName(tmpCar.PlayerName));
                    int curIW = 0;
                    if (displayManager.currentScene.pointsGTData.InstantWinners != null)
                    {
                        foreach (pgtInstantWinner iw in displayManager.currentScene.pointsGTData.InstantWinners)
                        {
                            if (tmpCar.Points >= iw.PointAmount)
                            {
                                currentCar.ActivateKey(curIW, true,
                                                       displayManager.currentScene.pointsGTData.InstantWinners[curIW].IconColor);
                            }
                            curIW++;
                        }
                    }

                    /*
                     * if (tmpCar.Points > currentSession.playerlist.InstantWinners[0].PointAmount)
                     * {
                     *  Debug.Log("First Key");
                     *
                     * }
                     * if (tmpCar.Points > currentSession.playerlist.InstantWinners[1].PointAmount)
                     *  {
                     *      Debug.Log("Second Key");
                     *      currentCar.ActivateKey(1, true, currentSession.playerlist.InstantWinners[1].IconColor);
                     *  }
                     *
                     * if (tmpCar.Points > currentSession.playerlist.InstantWinners[2].PointAmount)
                     *  {
                     *      Debug.Log("Third Key");
                     *      currentCar.ActivateKey(2, true, currentSession.playerlist.InstantWinners[2].IconColor);
                     *  }
                     */
                    lbls[plc].text = tmpCar.Points.ToString();
                }
                else
                {
                    car.GetComponent <UILabel>().text = "(" + tmpCar.Points + ") " + truncateName(tmpCar.PlayerName);
                }

                plc++;
            }
        }
    }
Beispiel #2
0
    public pgtPlayer getCarByTrackLocation(int TrackLocation)
    {
        pgtPlayer tmpPlayer = PointsGTPlayers.Find(r => r.trackLocation == TrackLocation + 1);

        return(tmpPlayer);
    }