Example #1
0
        public GameTile GetTileRelative(GameTile source, Integer2 relativePosition)
        {
            var tilePosition = GetTilePositon(source);

            var targetPosition = tilePosition + relativePosition;

            return(targetPosition.HasValue
                                ? this[targetPosition.Value]
                                : null);
        }
Example #2
0
        public GameTile this[Integer2 position]
        {
            get
            {
                if (position.x < 0 || position.y < 0)
                {
                    return(null);
                }

                int width  = tiles.GetLength(0);
                int height = tiles.GetLength(1);

                if (position.x >= width || position.y >= height)
                {
                    return(null);
                }

                return(tiles[position.x, position.y]);
            }
        }