Esempio n. 1
0
 /// <summary>
 /// Updates the position of race participants in the ranking (canvas)
 /// </summary>
 public void RebuildRanking(List <Agent> playersOnRace)
 {
     foreach (Transform child in contentHolder)
     {
         UIRankItem rankItem = child.GetComponent <UIRankItem>();
         int        newIndex = playersOnRace.FindIndex(x => x.carInfo.id == rankItem.playerID);
         child.SetSiblingIndex(newIndex);
     }
 }
Esempio n. 2
0
    /// <summary>
    /// Updates the progress bar of a given runner
    /// </summary>
    public void RefreshCarProgress(Agent car)
    {
        UIRankItem uiItem = contentHolder.GetComponentsInChildren <UIRankItem>().FirstOrDefault(x => x.playerID == car.carInfo.id);

        uiItem.RefreshLapProgressBar(car.waypointIndex);
    }
Esempio n. 3
0
    /// <summary>
    /// Instantiates a new line (player) in the Ranking Panel
    /// </summary>
    public void InstantiateRankItem(Agent newPlayer)
    {
        UIRankItem playerUI = Instantiate(playerUIPrefab, contentHolder) as UIRankItem;

        playerUI.SetupUI(newPlayer.carInfo.id, newPlayer.carInfo.playerInfo.iconSprite, newPlayer.carInfo.playerInfo.Name, newPlayer.transform, newPlayer.totalWaypointsToWin);
    }