示例#1
0
文件: Game.cs 项目: darocha/CycleR
        private ConcurrentDictionary <long, Cycle> createCycles(IEnumerable <User> players)
        {
            var spawns = _mode.GetGameSpawns();

            IEnumerable <Cycle> cycles = players.Select((user, index) => new Cycle(user.ID, spawns[index].StartPosition, spawns[index].StartVelocity, spawns[index].StartRotation, spawns[index].TrailColor, _map, _gameConfiguration));

            // Convert to Dictionary
            var cycleDictionary = new ConcurrentDictionary <long, Cycle>();

            foreach (Cycle cycle in cycles)
            {
                cycleDictionary.TryAdd(cycle.ID, cycle);
            }

            _mode.FillSpots(cycleDictionary, spawns, _map, _gameConfiguration);

            return(cycleDictionary);
        }