Beispiel #1
0
    void Down(int index)
    {
        if (index >= prop.cars.Length - 1)
        {
            return;
        }

        playerCars.Clear();
        playerCars.AddRange(prop.cars);

        //		foreach(HR_PlayerCars.Cars qwe in playerCars)
        //			Debug.Log(qwe.playerCar.name);

        HR_PlayerCars.Cars currentCar = playerCars [index];
        HR_PlayerCars.Cars nextCar    = playerCars [index + 1];

        playerCars.RemoveAt(index);
        playerCars.Insert(index, nextCar);

        playerCars.RemoveAt(index + 1);
        playerCars.Insert(index + 1, currentCar);

        prop.cars = playerCars.ToArray();
        PlayerPrefs.SetInt("SelectedPlayerCarIndex", 0);
    }
Beispiel #2
0
 void AddNewCar()
 {
     playerCars.Clear();
     playerCars.AddRange(prop.cars);
     HR_PlayerCars.Cars newCar = new HR_PlayerCars.Cars();
     playerCars.Add(newCar);
     prop.cars = playerCars.ToArray();
     PlayerPrefs.SetInt("SelectedPlayerCarIndex", 0);
 }
Beispiel #3
0
    void Up(int index)
    {
        if (index <= 0)
        {
            return;
        }

        playerCars.Clear();
        playerCars.AddRange(prop.cars);

        HR_PlayerCars.Cars currentCar  = playerCars [index];
        HR_PlayerCars.Cars previousCar = playerCars [index - 1];

        playerCars.RemoveAt(index);
        playerCars.RemoveAt(index - 1);

        playerCars.Insert(index - 1, currentCar);
        playerCars.Insert(index, previousCar);

        prop.cars = playerCars.ToArray();
        PlayerPrefs.SetInt("SelectedPlayerCarIndex", 0);
    }