示例#1
0
        private void findNeighbours(Map map, Coord loc, List<Coord> neighbours)
        {
            //var explorableDirs = new Direction[]
            //{
            //    Direction.North,
            //    Direction.East,
            //    Direction.South,
            //    Direction.West,
            //};

            var explorableDirs = (Direction[])Enum.GetValues(typeof(Direction));

            foreach (var dir in explorableDirs)
            {
                var to = loc.CoordFromDirection(dir);
                if (to.X >= 0 && to.X < map.Width
                    && to.Y >= 0 && to.Y < map.Height
                    && (map[to].Walkable || map[to].IsAttackable()))
                {
                    neighbours.Add(to);
                }
            }
        }