Пример #1
0
        public static ushort SearchScrollCellId(ushort cellid, MapScrollEnum type, MapRecord map)
        {
            var defaultCell = GetScrollDefaultCellId(cellid, type);
            var cells       = CellShapesProvider.GetMapBorder(GetOposedTransition(type));
            var walkables   = cells.FindAll(x => map.Walkable((ushort)x));

            return(walkables.Count == 0 ? map.RandomWalkableCell() : (ushort)walkables[new AsyncRandom().Next(0, walkables.Count - 1)]);
        }
Пример #2
0
 public static MapScrollEnum GetScrollTypeFromCell(short cellid)
 {
     if (CellShapesProvider.GetMapBorder(MapScrollEnum.Top).Contains(cellid))
     {
         return(MapScrollEnum.Top);
     }
     if (CellShapesProvider.GetMapBorder(MapScrollEnum.Bottom).Contains(cellid))
     {
         return(MapScrollEnum.Bottom);
     }
     if (CellShapesProvider.GetMapBorder(MapScrollEnum.Left).Contains(cellid))
     {
         return(MapScrollEnum.Left);
     }
     if (CellShapesProvider.GetMapBorder(MapScrollEnum.Right).Contains(cellid))
     {
         return(MapScrollEnum.Right);
     }
     return(MapScrollEnum.UNDEFINED);
 }