Exemple #1
0
        private int GetTileSpaces(Vector2 direction)
        {
            var tileSpaces = 0;
            var playerTile = _tiledMap.GetTileAtPosition(1, _blob.Position);
            var tileId     = 0;
            var x          = playerTile.XIndex;
            var y          = playerTile.YIndex;

            while (tileId == 0)
            {
                x += (int)direction.X;
                y += (int)direction.Y;
                var tile = _tiledMap.GetTileAt(1, x, y);

                if (tile == null)
                {
                    return(tileSpaces);
                }

                tileId = tile.Id;
                tileSpaces++;
            }

            return(tileSpaces - 1);
        }