Exemple #1
0
        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);
        }
Exemple #2
0
        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]);
        }
Exemple #3
0
 public PlayerInfo(CheckPoint checkPoint, Player player, CarController carController)
 {
     CheckPoint    = checkPoint;
     Player        = player;
     CarController = carController;
 }
Exemple #4
0
 public void RegisterCheckPoint(CheckPoint checkPoint)
 {
     _checkPoints.Add(checkPoint);
     _checkPoints = _checkPoints.OrderBy(x => x.Index).ToList();
 }