Class WaterTile
A water tile is a tile that draws with an animation, as well as a static part that represents the borders of the water.
public class WaterTile : AutoTile
- Inheritance
-
WaterTile
- Inherited Members
- Extension Methods
Constructors
WaterTile(string, string, int, IReadOnlyDictionary<Point, TextureRegion>, IReadOnlyDictionary<Direction2, Point[]>, ColorSettings, int[], bool, float, Category, TextureRegion, Func<Point, float>)
Creates a new tile with the given settings. To create an instance of a custom tile class, use Register(string, int, IReadOnlyDictionary<Point, TextureRegion>, Point, ColorScheme, float, bool, Category, TextureRegion, Func<Direction2, Point?>, int?, Func<Point, float>, Type).
protected WaterTile(string baseName, string name, int price, IReadOnlyDictionary<Point, TextureRegion> textures, IReadOnlyDictionary<Direction2, Point[]> regions, ColorSettings colorSettings, int[] colors, bool canBuy, float pathCostModifier, Tile.Category categories, TextureRegion icon, Func<Point, float> regionWeights)
Parameters
baseNamestringnamestringpriceinttexturesIReadOnlyDictionary<Point, TextureRegion>regionsIReadOnlyDictionary<Direction2, Point[]>colorSettingsColorSettingscolorsint[]canBuyboolpathCostModifierfloatcategoriesTile.CategoryiconTextureRegionregionWeightsFunc<Point, float>
Methods
ConnectsToTile(TileInstance, int, int, Func<Point, int, TileInstance>)
Override this method to determine what other tiles this auto-tile should connect to. By default, auto-tiles connect to other tiles of the same type.
protected override bool ConnectsToTile(TileInstance instance, int x, int y, Func<Point, int, TileInstance> getRelatedTileFunc = null)
Parameters
instanceTileInstanceThe tile instance of the current tile.
xintThe offset from the
instance's position in the x axis.yintThe offset from the
instance's position in the y axis.getRelatedTileFuncFunc<Point, int, TileInstance>A function that can optionally be supplied to override the GetTile(Point, int) method when checking for neighboring tiles. This is useful for when tile placement in the world is mocked, for example.
Returns
- bool
Whether this tile should connect to the tile at the offset position.
Draw(GameTime, object, TileInstance, Vector2, float, float, ICollection<Item>, bool, Func<Point, int, TileInstance>)
Draws this tile at the given position in the world using a Microsoft.Xna.Framework.Graphics.SpriteBatch or MLEM.Graphics.StaticSpriteBatch
public override bool Draw(GameTime time, object batch, TileInstance instance, Vector2 drawPos, float scale, float depthOffset, ICollection<StaticSpriteBatch.Item> items, bool hasStaticContext, Func<Point, int, TileInstance> getRelatedTileFunc = null)
Parameters
timeGameTimeThe game's current time.
batchobjectThe sprite batch to use for drawing, which can either be a Microsoft.Xna.Framework.Graphics.SpriteBatch or a MLEM.Graphics.StaticSpriteBatch.
instanceTileInstanceThe in-world instance of this tile being drawn. This may be null, in which case the tile is likely being draw in UI space.
drawPosVector2The position, in screen space, to draw at.
scalefloatThe scale to draw the tile with.
depthOffsetfloatA depth offset that can optionally be added to this tile's draw depth.
itemsICollection<StaticSpriteBatch.Item>The MLEM.Graphics.StaticSpriteBatch.Item collection that added items can optionally be added to.
hasStaticContextboolWhether this tile also has a static context, that is, whether it will already be drawn using a MLEM.Graphics.StaticSpriteBatch.
getRelatedTileFuncFunc<Point, int, TileInstance>A function that can optionally be supplied to override the GetTile(Point, int) method when checking for neighboring tiles. This is useful for when tile placement in the world is mocked, for example.
Returns
- bool
Whether this tile was fully drawn. If the
batchis a MLEM.Graphics.StaticSpriteBatch and false is returned, this tile will be marked as an animated tile, causing it to draw every frame.