Class FenceType
A fence type is a set of underlying, unchanging settinsg for a FenceWall object. Fence types can be registered using Register(FenceType).
[JsonConverter(typeof(MigratingStaticJsonConverter<FenceType>), new object[] { typeof(FenceType), "PrivateTypes", true })]
public class FenceType
- Inheritance
-
FenceType
- Inherited Members
- Extension Methods
Constructors
FenceType(string, float, TextureRegion, IReadOnlyDictionary<Point, TextureRegion>, Point, params ColorScheme[])
Creates a new fence type with the given settings.
public FenceType(string name, float price, TextureRegion icon, IReadOnlyDictionary<Point, TextureRegion> textures, Point textureRegion, params ColorScheme[] colorSchemes)
Parameters
namestringThe name of this fence type.
pricefloatThe price of a single element of this fence type.
iconTextureRegionThe build mode icon that this fence type optionally uses.
texturesIReadOnlyDictionary<Point, TextureRegion>The texture atlas that this fence type's <see cref="TextureRegion"/> is on.
textureRegionPointThe texture region on this fence's type <see cref="Textures"/> that marks the base region for this fence type.
colorSchemesColorScheme[]The color schemes that each layer of this fence type uses.
FenceType(string, float, TextureRegion, IReadOnlyDictionary<Point, TextureRegion>, Point, ColorSettings)
Creates a new fence type with the given settings.
public FenceType(string name, float price, TextureRegion icon, IReadOnlyDictionary<Point, TextureRegion> textures, Point textureRegion, ColorSettings colors)
Parameters
namestringThe name of this fence type.
pricefloatThe price of a single element of this fence type.
iconTextureRegionThe build mode icon that this fence type optionally uses.
texturesIReadOnlyDictionary<Point, TextureRegion>The texture atlas that this fence type's <see cref="TextureRegion"/> is on.
textureRegionPointThe texture region on this fence's type <see cref="Textures"/> that marks the base region for this fence type.
colorsColorSettingsThe color settings that this fence type uses.
Fields
Colors
The color settings to use for this fence wall.
public readonly ColorSettings Colors
Field Value
Icon
The build mode icon that this fence type optionally uses.
public readonly TextureRegion Icon
Field Value
- TextureRegion
Name
The name of this fence type.
public readonly string Name
Field Value
Price
The price of a single element of this fence type.
public readonly float Price
Field Value
TextureRegion
The texture region on this fence's type Textures that marks the base region for this fence type. Additional regions are gathered to the right of this region.
public readonly Point TextureRegion
Field Value
- Point
Textures
The texture atlas that this fence type's TextureRegion is on.
public readonly IReadOnlyDictionary<Point, TextureRegion> Textures
Field Value
- IReadOnlyDictionary<Point, TextureRegion>
Types
The set of all registered fence types, including vanilla and modded ones.
public static readonly ReadOnlyDictionary<string, FenceType> Types
Field Value
Properties
HasCollision
public bool HasCollision { get; init; }
Property Value
Methods
Draw(GameTime, SpriteBatch, Map, Point, Point, int, Vector2, bool, float, bool, bool, int[], Direction2, Color?)
Draws this fence type at the given location with the given settings.
public virtual void Draw(GameTime time, SpriteBatch batch, Map map, Point pos1, Point pos2, int floor, Vector2 drawPos, bool vertical, float scale, bool hasPoleNeg, bool hasPolePos, int[] colors, Direction2 cameraRotation, Color? overrideColor = null)
Parameters
timeGameTimeThe game time.
batchSpriteBatchThe sprite batch to use for drawing.
mapMapThe map this fence wall is on.
pos1PointThe first position in the Positions array.
pos2PointThe second position in the Positions array.
floorintThe floor.
drawPosVector2The position, in screen space, to draw at.
verticalboolWhether the fence wall is vertical.
scalefloatThe scale to draw with.
hasPoleNegboolWhether the fence drawn has a pole in the negative direction.
hasPolePosboolWhether the fence drawn has a pole in the positive direction.
colorsint[]The color indices in this fence type's Colors to draw with.
cameraRotationDirection2The camera rotation to draw with.
overrideColorColor?An optional override color to use instead of this fence type's Colors.
DrawUi(Element, SpriteBatch, GameTime, Map, int[], float)
Draws this fence in UI space, based on the position and size of the given MLEM.Ui.Elements.Element.
public virtual void DrawUi(Element e, SpriteBatch batch, GameTime time, Map map, int[] colors, float drawScale)
Parameters
eElementThe element to base position and size on.
batchSpriteBatchThe sprite batch to use for drawing.
timeGameTimeThe game time.
mapMapThe map.
colorsint[]The color indices in this fence type's Colors to draw with.
drawScalefloatThe scale to draw with.
Register(FenceType)
Registers the given fence type into the Types registry and returns it.
public static FenceType Register(FenceType type)
Parameters
typeFenceTypeThe fence type to register.
Returns
- FenceType
The registered fence type
type.