public void RegisterCarController(CheckPoint checkPoint, Player player, CarController carController) { var playerInfo = new PlayerInfo(checkPoint, player, carController); if (_playerInfos.ContainsKey(player)) { return; } _playerInfos.Add(player, playerInfo); }
public CheckPoint NextCheckPoint(Player key, CheckPoint checkPoint) { var playerInfo = GetPlayerInfo(key); if (playerInfo.CheckPoint < checkPoint) { return(checkPoint); } playerInfo.CheckPoint = checkPoint; if (checkPoint.Index < _checkPoints.Count) { return(_checkPoints[checkPoint.Index + 1]); } playerInfo.Lap++; return(_checkPoints[0]); }
public PlayerInfo(CheckPoint checkPoint, Player player, CarController carController) { CheckPoint = checkPoint; Player = player; CarController = carController; }
public void RegisterCheckPoint(CheckPoint checkPoint) { _checkPoints.Add(checkPoint); _checkPoints = _checkPoints.OrderBy(x => x.Index).ToList(); }