Map - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.World

Map Class

A map holds all of the data about a city, like its tiles, its objects and its roads.
A map is split into MapSection objects which allows faster retrieval of objects in an area.

public class Map : MLEM.Misc.GenericDataHolder

Inheritance System.Object 🡒 MLEM.Misc.GenericDataHolder 🡒 Map

Constructors

Map.Map(string, Point) Constructor

Creates a new map with the given name and size

public Map(string name, Microsoft.Xna.Framework.Point sizeInSections);

Parameters

name System.String
The name of this map

sizeInSections Microsoft.Xna.Framework.Point
The size, in sections, of this map

Fields

Map.MailToSend Field

A list of all Mail that needs to be sent by a mail carrier the next morning.
To send mail, use SendMail(Mail).

public readonly List<Mail> MailToSend;

Field Value

System.Collections.Generic.List<Mail>

Map.Name Field

The name of this map

public readonly string Name;

Field Value

System.String

Map.RoadRadius Field

This field holds the radius that roads are required to have (in road tiles) excluding the center dotted line tiles.
It is set to 2.

public const int RoadRadius = 2;

Field Value

System.Int32

Properties

Map.Size Property

The size in tiles that this map has.
This is always SizeInSections multiplied by Size.

public Microsoft.Xna.Framework.Point Size { get; set; }

Property Value

Microsoft.Xna.Framework.Point

Map.SizeInSections Property

The size, in sections (not tiles) that this map has

public Microsoft.Xna.Framework.Point SizeInSections { get; set; }

Property Value

Microsoft.Xna.Framework.Point

Map.StaticVersion Property

The static version of this map.
When a new save file is created, a static version of each map is loaded and used as the save file's basis.
If the static version of the save file is newer, their save file is updated to the new static map version, which causes all non-lot objects to be copied to the saved map.

public int StaticVersion { get; set; }

Property Value

System.Int32

Methods

Map.~Map() Method

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

~Map();

Map.AddHousehold(Lot, Person[]) Method

Adds a new household to this map by calling the Household constructor.

public TinyLife.World.Household AddHousehold(TinyLife.World.Lot lot, params TinyLife.Objects.Person[] people);

Parameters

lot Lot
The lot that the household should live on

people Person[]
The people to add to the household

Returns

Household
The newly created household

Map.AddLight(Light) Method

Adds the given light to the world at its Position

public void AddLight(TinyLife.Objects.Light light);

Parameters

light Light
The light to add

Map.AddLot(Rectangle) Method

Adds a new lot with the given area to this map's lots

public TinyLife.World.Lot AddLot(Microsoft.Xna.Framework.Rectangle area);

Parameters

area Microsoft.Xna.Framework.Rectangle
The area that the new lot should have

Returns

Lot
The newly created lot

Map.AddObject(MapObject) Method

Adds the given object to this map.
Note that, if the object's Id is already present on this map, this method will cause an exception.

public void AddObject(TinyLife.Objects.MapObject obj);

Parameters

obj MapObject
The object to add to this map

Map.AddRoad(Point) Method

Adds a road to the map at the given position.
This doesn't actually add the road tiles, but it notifies the pathfinder that there is a road center at this location.

public void AddRoad(Microsoft.Xna.Framework.Point pos);

Parameters

pos Microsoft.Xna.Framework.Point
The position to add a road to

Map.AddRoof(Roof) Method

Adds the given roof to this map

public void AddRoof(TinyLife.World.Roof roof);

Parameters

roof Roof
The roof to add

Map.AddWall(Point, Point) Method

Adds the given wall to the given position.

public bool AddWall(Microsoft.Xna.Framework.Point pos, Microsoft.Xna.Framework.Point secondPos);

Parameters

pos Microsoft.Xna.Framework.Point
The position that the new wall should have

secondPos Microsoft.Xna.Framework.Point
The second position that the new wall should have

Returns

System.Boolean
Whether the wall could be added

Map.AddWall(Wall, bool) Method

Adds the given wall to the given position.
Optionally, the Room related to that wall is re-calculated.

public bool AddWall(TinyLife.World.Wall wall, bool initializeRooms=true);

Parameters

wall Wall
The wall to add

initializeRooms System.Boolean
Whether added rooms should have concrete and roofing added to them. Defaults to true.

Returns

System.Boolean
Whether the wall could be added successfully

Map.ApplyCameraRotation(Vector2, bool, Nullable<Direction2>) Method

Applies the game's current CameraRotation to the given position in world space

public Microsoft.Xna.Framework.Vector2 ApplyCameraRotation(Microsoft.Xna.Framework.Vector2 worldPos, bool borderOffset=false, System.Nullable<MLEM.Misc.Direction2> cameraRotation=null);

Parameters

worldPos Microsoft.Xna.Framework.Vector2
The position, in world space

borderOffset System.Boolean
Whether a border offset should be applied. This is useful for tiles and other objects that aren't centered in the middle of their tiles, but that use the top-left corner of a tile for positioning.

cameraRotation System.Nullable<MLEM.Misc.Direction2>
An optional override camera rotation which should be used in favor of CameraRotation

Returns

Microsoft.Xna.Framework.Vector2
The position in world space, but with camera rotation appplied

Map.ApplyInverseCameraRotation(Vector2, Nullable<Direction2>) Method

Applies the game's current CameraRotation to the given position in world space in reverse, undoing the action done by ApplyCameraRotation(Vector2, bool, Nullable<Direction2>)

public Microsoft.Xna.Framework.Vector2 ApplyInverseCameraRotation(Microsoft.Xna.Framework.Vector2 worldPos, System.Nullable<MLEM.Misc.Direction2> cameraRotation=null);

Parameters

worldPos Microsoft.Xna.Framework.Vector2
The position, in world space

cameraRotation System.Nullable<MLEM.Misc.Direction2>
An optional override camera rotation which should be used in favor of CameraRotation

Returns

Microsoft.Xna.Framework.Vector2
The position in world space, but without camera rotation appplied

Map.CanWalkBetween(Person, Point, Point) Method

Returns whether the given person can walk between the two given positions.
Internally, this method only queries whether GetPathCost(Person, Point, Point) is lower than MLEM.Pathfinding.AStar<>.InfiniteCost.
Note that, for this method to return a proper result, nextPos has to be directly or diagonally adjacent to currPos.

public bool CanWalkBetween(TinyLife.Objects.Person person, Microsoft.Xna.Framework.Point currPos, Microsoft.Xna.Framework.Point nextPos);

Parameters

person Person
The person to get the path cost for

currPos Microsoft.Xna.Framework.Point
The current position

nextPos Microsoft.Xna.Framework.Point
The next, neighboring position

Returns

System.Boolean
Whether the two locations can be walked between

Map.Draw(GameTime, SpriteBatch, bool, Nullable<RectangleF>) Method

Draws this map and all of its objects.
Note that drawing in this manner uses multiple Microsoft.Xna.Framework.Graphics.RenderTarget2D objects, for things like the ground and the lightmaps.

public void Draw(Microsoft.Xna.Framework.GameTime time, Microsoft.Xna.Framework.Graphics.SpriteBatch batch, bool selectionMode, System.Nullable<MLEM.Misc.RectangleF> visibleArea=null);

Parameters

time Microsoft.Xna.Framework.GameTime
The game's time

batch Microsoft.Xna.Framework.Graphics.SpriteBatch
The sprite batch to use for drawing

selectionMode System.Boolean
Whether we're drawing in selection mode ("ShowSelectionEffect" cheat displays this mode)

visibleArea System.Nullable<MLEM.Misc.RectangleF>
The area that is visible to the camera. If this is null, MLEM.Cameras.Camera.GetVisibleRectangle is used instead

Map.GetClosestEmptyTile(Vector2, int, bool, bool, bool) Method

Returns the position of the closest tile that is empty.
An empty tile is a tile that has no MapObject instances on it.

public System.Nullable<Microsoft.Xna.Framework.Point> GetClosestEmptyTile(Microsoft.Xna.Framework.Vector2 pos, int radius=2, bool ignorePeople=true, bool hasToBeOnLot=false, bool sameRoom=false);

Parameters

pos Microsoft.Xna.Framework.Vector2
The position to be close to

radius System.Int32
The radius to search for empty tiles in

ignorePeople System.Boolean
Whether or not people should be ignored. If this is true, the returned empty tile might currently be occupied by a Person.

hasToBeOnLot System.Boolean
Whether or not the returned tile position has to be part of a Lot

sameRoom System.Boolean
Whether or not the returned tile position has to be in the same room as pos

Returns

System.Nullable<Microsoft.Xna.Framework.Point>
The closest empty tile, or null if there isn't one

Map.GetClosestExitRoad(Vector2) Method

Returns the point of the road that is at the edge of the map and the MLEM.Misc.Direction2 that the map border is in, and is also closest to the given position.
Since every map is expected to have at least one exit road, no checking is done to ensure that one exists.

public (Microsoft.Xna.Framework.Point,MLEM.Misc.Direction2) GetClosestExitRoad(Microsoft.Xna.Framework.Vector2 position);

Parameters

position Microsoft.Xna.Framework.Vector2

Returns

<Microsoft.Xna.Framework.Point,MLEM.Misc.Direction2>
The closest exit road

Map.GetClosestRoad(Point, int) Method

Returns the clost road marker to the given position, keeping the given radius in mind.

public System.Nullable<Microsoft.Xna.Framework.Point> GetClosestRoad(Microsoft.Xna.Framework.Point pos, int radius);

Parameters

pos Microsoft.Xna.Framework.Point
The position to find the closest road to

radius System.Int32
The radius, in tiles, to search for roads in

Returns

System.Nullable<Microsoft.Xna.Framework.Point>
The closest road point

Map.GetClosestSidewalk(Point, Vector2) Method

Returns the closest sidewalk position to the given road position.
A sidewalk is a tile whose name starts with "Concrete" that is RoadRadius+1 tiles away from the road marker.
Note that the road position must have IsRoad(Point) return true for it.

public System.Nullable<Microsoft.Xna.Framework.Point> GetClosestSidewalk(Microsoft.Xna.Framework.Point road, Microsoft.Xna.Framework.Vector2 pos);

Parameters

road Microsoft.Xna.Framework.Point
The road marker

pos Microsoft.Xna.Framework.Vector2
The position to which the distance should be shortest

Returns

System.Nullable<Microsoft.Xna.Framework.Point>
The closest sidewalk position

Map.GetDeadPerson(Guid) Method

Returns a dead Person with the given System.Guid id

public TinyLife.Objects.Person GetDeadPerson(System.Guid id);

Parameters

id System.Guid
The id to get a dead person by

Returns

Person
The dead person instance, or null if there is none

Map.GetDepth(Vector2, float, bool, bool, bool) Method

Gets the depth that should be used for drawing a Wall or Tile at the given position

public float GetDepth(Microsoft.Xna.Framework.Vector2 worldPos, float offset=0f, bool center=true, bool borderOffset=false, bool applyCameraRotation=true);

Parameters

worldPos Microsoft.Xna.Framework.Vector2
The position to get depth for, in tile coordinates

offset System.Single
An offset added to the depth value

center System.Boolean
Whether the position should be centered on the x axis

borderOffset System.Boolean
Whether the map border offset should be applied to the camera rotation using ApplyCameraRotation(Vector2, bool, Nullable<Direction2>). This value only has an effect if applyCameraRotation is true

applyCameraRotation System.Boolean
Whether the game's current CameraRotation should be applied using ApplyCameraRotation(Vector2, bool, Nullable<Direction2>)

Returns

System.Single
The depth to pass to the draw call

Map.GetExitRoads() Method

Returns the positions of all of the roads that are at the borders of this map and the MLEM.Misc.Direction2 that the map border is in

public System.Collections.Generic.IEnumerable<(Microsoft.Xna.Framework.Point,MLEM.Misc.Direction2)> GetExitRoads();

Returns

System.Collections.Generic.IEnumerable<<Microsoft.Xna.Framework.Point,MLEM.Misc.Direction2>>
All of the exit roads out of this map

Map.GetHousehold(Person) Method

Returns the household that the given Person lives in

public TinyLife.World.Household GetHousehold(TinyLife.Objects.Person person);

Parameters

person Person
The person to query

Returns

Household
The person's household, or null if there is none

Map.GetHousehold(Lot) Method

Returns the household that lives on the given Lot

public TinyLife.World.Household GetHousehold(TinyLife.World.Lot lot);

Parameters

lot Lot
The lot to query

Returns

Household
The household that lives on the lot, or null if none lives there

Map.GetHouseholds() Method

Returns a set of all of the Household instances that live on this map

public System.Collections.Generic.IEnumerable<TinyLife.World.Household> GetHouseholds();

Returns

System.Collections.Generic.IEnumerable<Household>
This map's households

Map.GetLot(Point) Method

Returns the lot that is present at the given position.
The lot returned will always have its Area contain the passed position.

public TinyLife.World.Lot GetLot(Microsoft.Xna.Framework.Point pos);

Parameters

pos Microsoft.Xna.Framework.Point
The position to query

Returns

Lot
The lot at that position, or null if there is none

Map.GetLot(Guid) Method

Returns the lot with the given id on this map.
The returned lot's Id will equal the given id.

public TinyLife.World.Lot GetLot(System.Guid id);

Parameters

id System.Guid
The id that the lot should have

Returns

Lot
The lot with the given id

Map.GetLots() Method

Returns a set of all of the Lot objects on this map

public System.Collections.Generic.IEnumerable<TinyLife.World.Lot> GetLots();

Returns

System.Collections.Generic.IEnumerable<Lot>
This map's lots

Map.GetObject<T>(Guid) Method

Returns the object with the given id of the given type.
If there is no object with that id, or its type does not match, null is returned.

public T GetObject<T>(System.Guid id)
    where T : TinyLife.Objects.MapObject;

Type parameters

T
The type that the object is expected to have

Parameters

id System.Guid
The id that the returned object should have

Returns

T
The object, or null if there is no matching one

Map.GetObjects<T>(RectangleF) Method

Returns a set of objects that are present in the given area.

public System.Collections.Generic.IEnumerable<T> GetObjects<T>(MLEM.Misc.RectangleF area)
    where T : TinyLife.Objects.MapObject;

Type parameters

T
The type that the objects need to have

Parameters

area MLEM.Misc.RectangleF
The area, in tile coordinates

Returns

System.Collections.Generic.IEnumerable<T>
A set of objects that match the criteria

Map.GetPathCost(Person, Point, Point) Method

Returns the cost to pathfind from the given current position to the given next position.
Note that, for this method to return a proper result, nextPos has to be directly or diagonally adjacent to currPos.

public float GetPathCost(TinyLife.Objects.Person person, Microsoft.Xna.Framework.Point currPos, Microsoft.Xna.Framework.Point nextPos);

Parameters

person Person
The person to get the path cost for

currPos Microsoft.Xna.Framework.Point
The current position

nextPos Microsoft.Xna.Framework.Point
The next, neighboring position

Returns

System.Single
The cost to path to this location

Map.GetPeople() Method

Returns all of the Person objects that are on this map

public System.Collections.Generic.IEnumerable<TinyLife.Objects.Person> GetPeople();

Returns

System.Collections.Generic.IEnumerable<Person>
This map's people

Map.GetRandomTile(Random, Vector2, int, Predicate<Point>) Method

Returns a random tile in the given radius that matches the given predicate.
If no tile is found, an empty System.Nullable<> is returned.

public System.Nullable<Microsoft.Xna.Framework.Point> GetRandomTile(System.Random random, Microsoft.Xna.Framework.Vector2 pos, int radius=32, System.Predicate<Microsoft.Xna.Framework.Point> valid=null);

Parameters

random System.Random
The random to use

pos Microsoft.Xna.Framework.Vector2
The position that the radius should be centered on

radius System.Int32
The radius

valid System.Predicate<Microsoft.Xna.Framework.Point>
A predicate that determines whether tile should be included

Returns

System.Nullable<Microsoft.Xna.Framework.Point>
A random tile that matches the given conditions

Map.GetRoads() Method

Returns a set of all of the road markers on this map

public System.Collections.Generic.IEnumerable<Microsoft.Xna.Framework.Point> GetRoads();

Returns

System.Collections.Generic.IEnumerable<Microsoft.Xna.Framework.Point>
A set of all road markers on this map

Map.GetRoof(Point) Method

Gets a Roof whose area contains the given position

public TinyLife.World.Roof GetRoof(Microsoft.Xna.Framework.Point pos);

Parameters

pos Microsoft.Xna.Framework.Point
The position to find a roof at

Returns

Roof
The roof at that position, or null if there is none

Map.GetRoom(Point) Method

Returns the room that the given position is contained in

public TinyLife.World.Room GetRoom(Microsoft.Xna.Framework.Point pos);

Parameters

pos Microsoft.Xna.Framework.Point
The position to query

Returns

Room
The room at that location, or null if there is none

Map.GetSection(Point) Method

Returns the MapSection at the given tile position

public TinyLife.World.MapSection GetSection(Microsoft.Xna.Framework.Point pos);

Parameters

pos Microsoft.Xna.Framework.Point
The tile position

Returns

MapSection
The section at that position

Map.GetSections(Point, int) Method

Returns a set of sections that are contained in (or intersect with) the given area

public System.Collections.Generic.IEnumerable<TinyLife.World.MapSection> GetSections(Microsoft.Xna.Framework.Point point, int radiusIncrease);

Parameters

point Microsoft.Xna.Framework.Point
The position to find the section for, in tile coordinates

radiusIncrease System.Int32
The radius, in sections, that the search area should be extended by

Returns

System.Collections.Generic.IEnumerable<MapSection>
A set of sections covered by this area

Map.GetSections(RectangleF, int) Method

Returns a set of sections that are contained in (or intersect with) the given area

public System.Collections.Generic.IEnumerable<TinyLife.World.MapSection> GetSections(MLEM.Misc.RectangleF area, int radiusIncrease);

Parameters

area MLEM.Misc.RectangleF
The area to find sections in, in tile coordinates

radiusIncrease System.Int32
The radius, in sections, that the search area should be extended by

Returns

System.Collections.Generic.IEnumerable<MapSection>
A set of sections covered by this area

Map.GetTile(Point) Method

Returns the tile at the given position on this map

public TinyLife.World.Tile GetTile(Microsoft.Xna.Framework.Point pos);

Parameters

pos Microsoft.Xna.Framework.Point
The position to query

Returns

Tile
The tile at that position

Map.GetWallBetween(Point, Point) Method

Returns the wall between the pos and secondPos.
A wall is between two positions if its Positions are exactly those two positions, ignoring their order.

public TinyLife.World.Wall GetWallBetween(Microsoft.Xna.Framework.Point pos, Microsoft.Xna.Framework.Point secondPos);

Parameters

pos Microsoft.Xna.Framework.Point
The first position

secondPos Microsoft.Xna.Framework.Point
The second position

Returns

Wall
The wall between the two positions, or null if there is none

Map.GetWalls(RectangleF) Method

Returns a set of walls in the given area.
All Wall objects for which at least one Positions entry is contained in the area are returned.

public System.Collections.Generic.IEnumerable<TinyLife.World.Wall> GetWalls(MLEM.Misc.RectangleF area);

Parameters

area MLEM.Misc.RectangleF
The area to query for walls

Returns

System.Collections.Generic.IEnumerable<Wall>
A set of walls in the area

Map.IsFreeSpot(Point) Method

Returns whether or not the given position on the given map is free for a Person to stand in

public bool IsFreeSpot(Microsoft.Xna.Framework.Point pos);

Parameters

pos Microsoft.Xna.Framework.Point
The position to query

Returns

System.Boolean
Whether this position is free to stand on

Map.IsInBounds(Point) Method

Returns whether the given position is in bounds of this map's Size

public bool IsInBounds(Microsoft.Xna.Framework.Point pos);

Parameters

pos Microsoft.Xna.Framework.Point
The position to query

Returns

System.Boolean
true if the position is in bounds, false otherwise

Map.IsInSectionBounds(Point) Method

Returns whether the given section position is in bounds of this map's SizeInSections.

public bool IsInSectionBounds(Microsoft.Xna.Framework.Point section);

Parameters

section Microsoft.Xna.Framework.Point
The section position to query

Returns

System.Boolean
true if the position is in bounds, false otherwise

Map.IsRoad(Point) Method

Returns whether the given position contains a road.
This doesn't query road tiles, but it queries for road markers added by AddRoad(Point).

public bool IsRoad(Microsoft.Xna.Framework.Point pos);

Parameters

pos Microsoft.Xna.Framework.Point

Returns

System.Boolean

Map.LoadStaticMap(string) Method

Loads a static map with the given name from the game's content directory.
Note that the map is not validated (Validate(Action<string>)).

public static TinyLife.World.Map LoadStaticMap(string name);

Parameters

name System.String
The name of the static map

Returns

Map
The static map that was loaded

Map.MarkDirtyForPathfinding(Point) Method

Marks the given position dirty for pathfinding purposes.
When a path is found again close to this position, its cost (GetPathCost(Person, Point, Point)) will be re-calculated.
This method is called by Furniture when it is placed for removed.

public void MarkDirtyForPathfinding(Microsoft.Xna.Framework.Point pos);

Parameters

pos Microsoft.Xna.Framework.Point
The position to mark dirty

Map.MoveEverything(Point, Rectangle, bool) Method

Moves all of the objects, walls, tiles and roofs in the given area in the world, optionally moving the lots as well

public void MoveEverything(Microsoft.Xna.Framework.Point offset, Microsoft.Xna.Framework.Rectangle area, bool moveLots);

Parameters

offset Microsoft.Xna.Framework.Point
The offset to move things by

area Microsoft.Xna.Framework.Rectangle
The area to move

moveLots System.Boolean
Whether lots should be moved as well. The content of lots will be moved regardless of this parameter

Map.OnCameraRotationChanged(Direction2, Direction2) Method

A method that is called when CameraRotation is changed.
When changing camera rotation manually, this method should be called along with the change.

public void OnCameraRotationChanged(MLEM.Misc.Direction2 oldRotation, MLEM.Misc.Direction2 newRotation);

Parameters

oldRotation MLEM.Misc.Direction2

newRotation MLEM.Misc.Direction2

Map.PlaySound(SoundEffect, AudioEmitter, float, float, bool, bool) Method

Plays a sound at the given location (in world space) with the given Microsoft.Xna.Framework.Audio.AudioEmitter, whose Microsoft.Xna.Framework.Audio.AudioEmitter.Position can be updated by the caller using ToSoundPos(Vector2).
If the sound should move in a static locatdion, use PlaySound(SoundEffect, Vector2, float, float, bool, bool) instead.
Note that the returned Microsoft.Xna.Framework.Audio.SoundEffectInstance does not need to be disposed when it is finished playing.

public Microsoft.Xna.Framework.Audio.SoundEffectInstance PlaySound(Microsoft.Xna.Framework.Audio.SoundEffect sound, Microsoft.Xna.Framework.Audio.AudioEmitter emitter, float volume=1f, float pitch=0f, bool loop=false, bool applyWorldSoundVolume=true);

Parameters

sound Microsoft.Xna.Framework.Audio.SoundEffect
The sound effect to play

emitter Microsoft.Xna.Framework.Audio.AudioEmitter
The audio emitter, whose Microsoft.Xna.Framework.Audio.AudioEmitter.Position should be set in screen space

volume System.Single
The sound's volume, between 0 and 1 (default)

pitch System.Single
The sound's pitch, between -1, 0 (default) and 1

loop System.Boolean
Whether or not the sound should loop

applyWorldSoundVolume System.Boolean
Whether the WorldSoundVolume should be applied to the passed volume

Returns

Microsoft.Xna.Framework.Audio.SoundEffectInstance
The sound effect instance that is responsible for playing this sound, which can be stopped or paused

Map.PlaySound(SoundEffect, Vector2, float, float, bool, bool) Method

Plays a sound at the given location (in world space) statically.
If the sound should move while being played, use PlaySound(SoundEffect, AudioEmitter, float, float, bool, bool) instead.
Note that the returned Microsoft.Xna.Framework.Audio.SoundEffectInstance does not need to be disposed when it is finished playing.

public Microsoft.Xna.Framework.Audio.SoundEffectInstance PlaySound(Microsoft.Xna.Framework.Audio.SoundEffect sound, Microsoft.Xna.Framework.Vector2 pos, float volume=1f, float pitch=0f, bool loop=false, bool applyWorldSoundVolume=true);

Parameters

sound Microsoft.Xna.Framework.Audio.SoundEffect
The sound effect to play

pos Microsoft.Xna.Framework.Vector2
The position, in world space, to play the sound at

volume System.Single
The sound's volume, between 0 and 1 (default)

pitch System.Single
The sound's pitch, between -1, 0 (default) and 1

loop System.Boolean
Whether or not the sound should loop

applyWorldSoundVolume System.Boolean
Whether the WorldSoundVolume should be applied to the passed volume

Returns

Microsoft.Xna.Framework.Audio.SoundEffectInstance
The sound effect instance that is responsible for playing this sound, which can be stopped or paused

Map.RemoveHousehold(Household) Method

Removes the given household from this map

public void RemoveHousehold(TinyLife.World.Household household);

Parameters

household Household
The household to remove

Map.RemoveLight(Light) Method

Removes the given light from the world

public void RemoveLight(TinyLife.Objects.Light light);

Parameters

light Light
The light to remove

Map.RemoveLot(Lot) Method

Removes the given lot from this map's lots

public void RemoveLot(TinyLife.World.Lot lot);

Parameters

lot Lot
The lot to remove

Map.RemoveObject(MapObject) Method

Removes the given object from this map and its underlying MapSection.
This also calls OnRemoved().

public void RemoveObject(TinyLife.Objects.MapObject obj);

Parameters

obj MapObject
The object to remove

Map.RemoveRoof(Roof) Method

Removes the given Roof from this map

public void RemoveRoof(TinyLife.World.Roof roof);

Parameters

roof Roof
The roof to remove

Map.RemoveWall(Wall, bool) Method

Removes the given wall from the map

public bool RemoveWall(TinyLife.World.Wall wall, bool initializeRooms=true);

Parameters

wall Wall
The wall to remove

initializeRooms System.Boolean
Whether added rooms should have concrete and roofing added to them. Defaults to true.

Returns

System.Boolean
Whether the wall was present on the map and could be removed

Map.SendMail(Mail) Method

Sends the specified Mail, which enqueues it for delivery for the next morning.
This effectively adds the mail safely to the MailToSend list.

public void SendMail(TinyLife.World.Mail mail);

Parameters

mail Mail
The mail to send the next morning

Map.SetTile(Point, Tile) Method

Sets the tile at the given position to the given tile

public void SetTile(Microsoft.Xna.Framework.Point pos, TinyLife.World.Tile tile);

Parameters

pos Microsoft.Xna.Framework.Point
The position

tile Tile
The tile

Map.Update(GameTime, TimeSpan, GameSpeed) Method

Updates this map, its MapSection objects and its Households.

public void Update(Microsoft.Xna.Framework.GameTime time, System.TimeSpan passedInGame, TinyLife.GameSpeed speed);

Parameters

time Microsoft.Xna.Framework.GameTime
The game's time

passedInGame System.TimeSpan
The amount of time that has passed in game

speed GameSpeed
The speed that the game is set to

Map.Validate(Action<string>) Method

This method is called when this object is loaded from disk.
When called on a map, each MapSection is validated, and roads and rooms are generated.

public void Validate(System.Action<string> setState);

Parameters

setState System.Action<System.String>

Map.ValidateRooms(Point) Method

Removes all outdated rooms on this map after calling their Validate() methods.
This is called by AddWall(Wall, bool) and a few other methods.

public void ValidateRooms(Microsoft.Xna.Framework.Point position);

Parameters

position Microsoft.Xna.Framework.Point
The position around which to validate rooms

Events

Map.OnObjectAdded Event

An event that is invoked when a MapObject is added to this map using AddObject(MapObject)

public event OnObjectAdded;

Event Type

System.Action<MapObject>

Map.OnObjectRemoved Event

An event that is invoked when a MapObject is removed from this map using RemoveObject(MapObject)

public event OnObjectRemoved;

Event Type

System.Action<MapObject>

Map.OnUpdate Event

An event that is invoked when this map is updated in Update(GameTime, TimeSpan, GameSpeed)

public event OnUpdate;

Event Type

UpdateDelegate(GameTime, TimeSpan, GameSpeed, EventPhase)