Пример #1
0
        public void SetupPoints(int count, int deviation)
        {
            while (Points.Count < count)
            {
                int x = Random.Next(deviation, Width - deviation);
                int y = Random.Next(deviation, Height - deviation);
                if (!Points.Contains(new Point(x, y)))
                {
                    Points.Add(new Point(x, y));
                }
            }

            /*StartRoomGroup = new Home(this)
             * {
             *  CaveColor = new TileColor(new Color(64, 64, 64), new Color(160, 160, 160)),
             *  BrickColor = new TileColor(new Color(64, 64, 64), new Color(160, 160, 160))
             * };*/
            Groups.AddRange(GroupGenerator.Generate(this));
            var i = 0;
            IEnumerable <Point> shuffled = Points.Shuffle(Random);
            var toAssign = shuffled.Take(Groups.Count);

            foreach (var cell in toAssign.Select(GetCell))
            {
                cell.Group = Groups[i];
                i++;
            }
            foreach (var cell in Points.Select(GetCell))
            {
                cell.NewRoom();
            }

            /*StartRoom = shuffled.Last();
             * Points.Remove(StartRoom);
             * var startCell = GetCell(StartRoom);
             * startCell.Group = StartRoomGroup;
             * StartRoomGroup.PlaceRoom(this, startCell);*/
        }