Exemplo n.º 1
0
        /// <summary>
        /// Convert a pixel location to a map cell location
        /// </summary>
        /// <returns></returns>
        public RectangleInt GetPixelPosition(SokobanMap Map, VectorInt cell)
        {
            VectorInt pos = cell.Divide(tileSize);

            return new RectangleInt(pos, pos.Add(Map.Size));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Convert a pixel location to a map cell location
        /// </summary>
        /// <param name="Map"></param>
        /// <param name="pixel"></param>
        /// <returns></returns>
        public VectorInt GetCellPosition(SokobanMap Map, VectorInt pixel)
        {
            VectorInt pos = pixel.Divide(tileSize);

            if (pos.X >= Map.Size.X || pos.Y >= Map.Size.Y) return VectorInt.MinValue;

            return pos;
        }