Пример #1
0
        public World(Seed seed)
        {
            head = new Dictionary <string, string>(seed.head);
            grid = new Cube.Grid(seed.size.width, seed.size.height);
            dest = seed.dest.ToList();

            foreach (var c in seed.cube.Where(c => c.body.Count > 0))
            {
                var vec = c.body[0];
                grid.Place((Cube.Type)c.type, vec.x, vec.y);
                foreach (var one in c.body)
                {
                    grid.Spread(vec.x, vec.y, one.x, one.y);
                }

                var unit = grid.Get(vec.x, vec.y);
                if (unit == null)
                {
                    continue;
                }

                var group = unit.Group;
                if (group == null)
                {
                    continue;
                }

                group.Path.Loop = c.move.loop;
                group.Path.Move = c.move.path.Select(pair => new Cube.Path.Pair
                {
                    Count = pair.time,
                    Doing = (Cube.Path.Doing)pair.type
                }).ToList();
            }
        }
Пример #2
0
 public World(int width, int height)
 {
     grid = new Cube.Grid(width, height);
     head = new Dictionary <string, string>();
     dest = new List <Seed.Vec2>();
 }