示例#1
0
        public static Dictionary <enum_TileDirection, T> GetDirectionAxies <T>(int width, int height, TileAxis centerAxis, List <enum_TileDirection> directions, Func <TileAxis, T> OnItemGet)
        {
            Dictionary <enum_TileDirection, T> axisList = new Dictionary <enum_TileDirection, T>();

            directions.Traversal((enum_TileDirection direction) => {
                TileAxis targetAxis = centerAxis.DirectionAxis(direction);
                if (targetAxis.X < 0 || targetAxis.Y < 0 || targetAxis.X >= width || targetAxis.Y >= height)
                {
                    return;
                }
                axisList.Add(direction, OnItemGet(targetAxis));
            });
            return(axisList);
        }
示例#2
0
        public static List <TileAxis> GetDirectionAxies(int width, int height, TileAxis centerAxis, List <enum_TileDirection> directions)
        {
            List <TileAxis> axisList = new List <TileAxis>();

            directions.Traversal((enum_TileDirection direction) => {
                TileAxis targetAxis = centerAxis.DirectionAxis(direction);
                if (targetAxis.X < 0 || targetAxis.Y < 0 || targetAxis.X >= width || targetAxis.Y >= height)
                {
                    return;
                }
                axisList.Add(targetAxis);
            });
            return(axisList);
        }