Class Fence
A fence is a furniture used by things like CountryFence that auto-connects similarly to CornerFurniture, but by actually adding additional connection textures onto the regular object textures
[Obsolete("Use the new FenceWall system instead")]
public class Fence : Furniture, IGenericDataHolder
- Inheritance
-
JsonTypeSafeGenericDataHolderFence
- Implements
-
IGenericDataHolder
- Inherited Members
-
JsonTypeSafeGenericDataHolder.GetDataKeys()
- Extension Methods
Constructors
Fence(Guid, FurnitureType, int[], Map, Vector2, float)
Creates a new furniture instance. By default, this is done using Construct<T>(int[], Map, Vector2, float, Guid?).
public Fence(Guid id, FurnitureType type, int[] colors, Map map, Vector2 pos, float floor)
Parameters
id
GuidThe id to apply to the created furniture instance
type
FurnitureTypeThe type to create an instance of
colors
int[]The colors to apply to the furniture
map
MapThe map to create the furniture on
pos
Vector2The position that the furniture should have
floor
floatThe floor that this object is on.
Methods
Draw(GameTime, object, Vector2, float, Vector2, Color?, Direction2, int[], float, bool, ParentInfo, float, List<Item>)
Draws this furniture in the world with the given settings. This is a more generalized version of Draw(GameTime, object, Vector2, Color?, List<Item>)
public override void Draw(GameTime time, object batch, Vector2 pos, float floor, Vector2 drawPos, Color? overrideColor, Direction2 rotation, int[] colors, float drawScale, bool pivot, ParentInfo parent, float depthOffset, List<StaticSpriteBatch.Item> items)
Parameters
time
GameTimeThe game time
batch
objectThe sprite batch to draw with, which is either a Microsoft.Xna.Framework.Graphics.SpriteBatch or MLEM.Graphics.StaticSpriteBatch.
pos
Vector2The position, in world space, that the furniture is at
floor
floatThe floor to draw at.
drawPos
Vector2The position, in draw space, to draw the furniture at
overrideColor
Color?An optional color to override the default colors of the furniture
rotation
Direction2The rotation that the furniture should be drawn with.
colors
int[]The colors to draw the furniture with
drawScale
floatThe scale to draw the furniture with
pivot
boolWhether or not to move the furniture by its texture's pivot point
parent
ParentInfoThe object that this furniture is latched on to, or null if there is none
depthOffset
floatA value that is added onto the calculated depth of the object
items
List<StaticSpriteBatch.Item>A list of sprite batch items that items should be added to if the
batch
is a MLEM.Graphics.StaticSpriteBatch.
OnNeighborChanged(Furniture)
This method gets called when any neighboring furniture changes in NotifyNeighbors(). The neighboring furniture is passed. By default, this method does nothing, so calling base is not necessary.
protected override void OnNeighborChanged(Furniture neighbor)
Parameters
neighbor
FurnitureThe neighbor furniture that changed
ShouldConnectTo(Furniture)
This method returns whether this furniture instance should connect to the neighbor
furniture.
By default, this is only true if the FurnitureType is the same.
protected virtual bool ShouldConnectTo(Furniture neighbor)
Parameters
neighbor
FurnitureThe neighbor furniture
Returns
- bool
Whether they should connect
Validate(AppliedMigrations)
This method is called when this object is loaded from disk. Returning false on this method causes the object to be removed from the map. By default, this method invokes OnValidated and OnEventsAttachable.
public override bool Validate(AppliedMigrations appliedMigrations)
Parameters
appliedMigrations
AppliedMigrations
Returns
- bool
false if the object is not valid, true otherwise