Class GameImpl
- Namespace
- TinyLife
- Assembly
- Tiny Life.dll
The main class for Tiny Life, which houses a set of important game-wide properties.
public class GameImpl : MlemGame, IDisposable
- Inheritance
-
GameMlemGameGameImpl
- Implements
- Inherited Members
-
MlemGame.GraphicsDeviceManagerMlemGame.Update(GameTime)MlemGame.Draw(GameTime)MlemGame.InitializeDefaultUiStyle(SpriteBatch)MlemGame.InputMlemGame.SpriteBatchMlemGame.InputHandlerMlemGame.UiSystemMlemGame.OnLoadContentMlemGame.PreUpdateMlemGame.OnUpdateMlemGame.PreDrawMlemGame.OnDrawGame.Dispose()Game.Exit()Game.ResetElapsedTime()Game.SuppressDraw()Game.RunOneFrame()Game.Run()Game.Run(GameRunBehavior)Game.Tick()Game.BeginDraw()Game.EndDraw()Game.BeginRun()Game.EndRun()Game.UnloadContent()Game.Initialize()Game.LaunchParametersGame.ComponentsGame.InactiveSleepTimeGame.MaxElapsedTimeGame.IsActiveGame.IsMouseVisibleGame.TargetElapsedTimeGame.IsFixedTimeStepGame.ServicesGame.ContentGame.GraphicsDeviceGame.WindowGame.ActivatedGame.DeactivatedGame.DisposedGame.Exiting
- Extension Methods
Fields
Achievements
A set of Achievement instances being tracked on this map. Achievements are automatically added to this collection if they are registered as AchievementType instances. To complete an achievement, use CompleteAchievement(AchievementType).
public readonly HashSet<Achievement> Achievements
Field Value
CurrentCursor
The CursorType that is currently used. This is reset to Default at the start of every update.
public CursorType CurrentCursor
Field Value
Version
The game's version, gathered from the assembly
public static readonly string Version
Field Value
Properties
Camera
The game's in-world camera, created in LoadContent()
public Camera Camera { get; }
Property Value
- Camera
CurrentHousehold
The household that is currently being played, or
null
if in the main menu, editing a lot or on the map select screen
public Household CurrentHousehold { get; }
Property Value
CurrentLot
The lot that is currently being played on or edited, or
null
if in the main menu or on the map select screen
public Lot CurrentLot { get; }
Property Value
CurrentTool
The Tool that is currently selected. Should always be set to either PlayModeTool or any of BuildTools.
public Tool CurrentTool { get; set; }
Property Value
CursorPosition
The position that the game's cursor is currently at. If gamepad controls are being used, an internal cursor position is returned. Otherwise, MLEM.Input.InputHandler.MousePosition is returned.
public Vector2 CursorPosition { get; }
Property Value
- Vector2
FollowingPerson
The Person that the camera is currently locked onto
public Person FollowingPerson { get; set; }
Property Value
GraphicsMetrics
The game's graphics metrics, gathered at the end of every DoDraw(GameTime) call
public GraphicsMetrics GraphicsMetrics { get; }
Property Value
- GraphicsMetrics
Instance
The game's singleton instance
public static GameImpl Instance { get; }
Property Value
Listener
The game's Microsoft.Xna.Framework.Audio.AudioListener that is automatically moved to the Camera's position
public AudioListener Listener { get; }
Property Value
- AudioListener
Map
The map that the game is currently on, or
null
if in the main menu
public Map Map { get; }
Property Value
Mode
The GameImpl.GameMode that is currently active
public GameImpl.GameMode Mode { get; }
Property Value
Money
The money that the CurrentHousehold has, or MaxValue if there is no active household
public float Money { get; set; }
Property Value
SaveName
The name of the save file that is currently being played, or
null
if in the main menu
public string SaveName { get; }
Property Value
Speed
The current GameSpeed. Note that, if the current speed is VeryFast and the game CanBeExtremelyFast(), ExtremelyFast is returned. You can cause any ui MLEM.Ui.RootElement instances to pause the game by using SetPauseGame(RootElement, bool).
public GameSpeed Speed { get; set; }
Property Value
Methods
CanBeExtremelyFast()
Returns whether the game allows changing the speed to ExtremelyFast at the current time. If this returns true, and Speed is set to VeryFast, the ExtremelyFast speed is automatically engaged.
public bool CanBeExtremelyFast()
Returns
- bool
Whether the game can become extremely fast
CanSwitchGameModes()
Returns whether the game mode of the game can currently be switched. This method checks the CharacterCreator if it is active, as well as the CurrentTool and the CurrentLot's requirements.
public bool CanSwitchGameModes()
Returns
- bool
Whether the game can currently switch game modes.
CompleteAchievement(AchievementType)
Completes the achievement in this map's Achievements collection with the given AchievementType.
public bool CompleteAchievement(AchievementType type)
Parameters
type
AchievementTypeThe type of achievement to complete.
Returns
Dispose(bool)
protected override void Dispose(bool disposing)
Parameters
disposing
bool
DoDraw(GameTime)
protected override void DoDraw(GameTime gameTime)
Parameters
gameTime
GameTime
DoUpdate(GameTime)
protected override void DoUpdate(GameTime gameTime)
Parameters
gameTime
GameTime
FadeKeyboardLighting(Color)
Fades the keyboard lighting at a constant speed to make it result in the passed color. This method only has an effect if the game is running on desktop, and the user has a lighting-capable keyboard.
public void FadeKeyboardLighting(Color newColor)
Parameters
newColor
ColorThe color to fade to; transparency is ignored
IsCursorOnUi()
Returns true if the mouse is currently on top of any ui element in the MLEM.Ui.UiSystem or the system's auto-navigation cursor is currently being used.
public bool IsCursorOnUi()
Returns
- bool
true if the cursor is currently on the ui.
IsLotVisible(Lot)
Returns whether the given lot is considered visible to the player. Note that passing the CurrentHousehold's Lot will always cause this method to return true.
public bool IsLotVisible(Lot lot)
Parameters
lot
LotThe lot to query
Returns
- bool
Whether the lot is visible
LoadContent()
protected override void LoadContent()
MarkLotNonVisible(Lot)
Marks a lot non-visible if it's currently visible to the player.
public void MarkLotNonVisible(Lot lot)
Parameters
lot
LotThe lot to remove visibility for
MarkLotVisible(Lot)
Marks the given lot as visible for the player. The method VisitLot(Lot) should be used in favor of this method in most cases. By default, visibility lasts for 30 seconds of real time.
public void MarkLotVisible(Lot lot)
Parameters
lot
LotThe lot to mark as visible
RotateCamera(bool)
Rotates the camera by 90 degrees in a clockwise or counter-clockwise direction.
public void RotateCamera(bool ccw)
Parameters
ccw
boolWhether the rotation should be counter-clockwise.
SwitchGameMode(GameMode)
Switches the game mode to the given mode, and sets up all of the required data. Note that some game modes require certain data to be set prior to calling this method.
public void SwitchGameMode(GameImpl.GameMode mode)
Parameters
TakeScreenshot(Point, RectangleF?, Matrix?, RenderTarget2D)
Takes a screenshot and stores it in the default location, using a file name that contains the current date and time
public void TakeScreenshot(Point size, RectangleF? visibleArea = null, Matrix? visibleMatrix = null, RenderTarget2D lightmap = null)
Parameters
size
PointThe size, in pixels, of the resulting screenshots
visibleArea
RectangleF?The area that should be marked as visible, in world space. This determines culling values.
visibleMatrix
Matrix?A matrix that has a translation and scale that determines the visible area of the screenshot
lightmap
RenderTarget2DThe light map to draw light onto, or null to use the default light map
Events
OnFinishedLoading
An event that is raised when the game's loading screen fades out.
public event Action OnFinishedLoading
Event Type
OnLoadContentLater
An event that is raised in the game's loading screen while loading additional mod content.
public event Action OnLoadContentLater