C# Class MrGravity.Level

This class represents a level in the game
ファイルを表示 Open project: DizWARE/Mr-Gravity Class Usage Examples

Public Properties

Property Type Description
MCam Camera
MDeaths int
MNumCollectable int
MNumCollected int
MTimer double

Public Methods

Method Description
Dispose ( ) : void
Draw ( SpriteBatch spriteBatch, GameTime gameTime, Matrix scale ) : void

Draws the level background on to the screen

Level ( String filepath, IControlScheme controls, Viewport viewport ) : System

Initializes a new instance of the Level class.

Load ( Microsoft.Xna.Framework.Content.ContentManager content ) : void

Loads the level from the content manager

Load ( Microsoft.Xna.Framework.Content.ContentManager content, string assetName ) : void

Loads the level from the content manager

MainMenuLevel ( string filepath, IControlScheme controls, Viewport viewport, Rectangle region ) : Level
Reload ( ) : void

Reloads the content in this level

Reset ( ) : void

Preps the level to reload content

ResetAll ( ) : void
ResetScores ( ) : void

Resets the Scores for this level to 0.

Respawn ( ) : void

Respawn the player. Reset gravity direction and clear player velocity TODO - Reset all other objects as well

Update ( GameTime gameTime, GameStates &gameState ) : void

Updates the level's progress

UpdateParticles ( object sender, DoWorkEventArgs e ) : void
UpdateStars ( ) : void

Private Methods

Method Description
GetAnimation ( string name ) : AnimatedSprite

Returns the proper animation for the given tile

HandleCollisions ( PhysicsObject physObj, GameStates &gameState ) : void

Checks to see if given object is colliding with any other object and handles the collision

PrepareCollisionMatrix ( ) : void

Prepares the collision matrix in the game

RemoveFromMatrix ( GameObject obj ) : void

Removes the object from the matrix(for collectables

UpdateCollisionMatrix ( GameObject obj, Vector2 oldPosition ) : void

Updates the collision matrix with the new position

Method Details

Dispose() public method

public Dispose ( ) : void
return void

Draw() public method

Draws the level background on to the screen
public Draw ( SpriteBatch spriteBatch, GameTime gameTime, Matrix scale ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch Sprite batch that we use to draw textures
gameTime Microsoft.Xna.Framework.GameTime
scale Matrix
return void

Level() public method

Initializes a new instance of the Level class.
public Level ( String filepath, IControlScheme controls, Viewport viewport ) : System
filepath String
controls IControlScheme The controls scheme
viewport Microsoft.Xna.Framework.Graphics.Viewport The viewport for the cameras
return System

Load() public method

Loads the level from the content manager
public Load ( Microsoft.Xna.Framework.Content.ContentManager content ) : void
content Microsoft.Xna.Framework.Content.ContentManager Content Manager to load from
return void

Load() public method

Loads the level from the content manager
public Load ( Microsoft.Xna.Framework.Content.ContentManager content, string assetName ) : void
content Microsoft.Xna.Framework.Content.ContentManager Content Manager to load from
assetName string
return void

MainMenuLevel() public static method

public static MainMenuLevel ( string filepath, IControlScheme controls, Viewport viewport, Rectangle region ) : Level
filepath string
controls IControlScheme
viewport Microsoft.Xna.Framework.Graphics.Viewport
region Microsoft.Xna.Framework.Rectangle
return Level

Reload() public method

Reloads the content in this level
public Reload ( ) : void
return void

Reset() public method

Preps the level to reload content
public Reset ( ) : void
return void

ResetAll() public method

public ResetAll ( ) : void
return void

ResetScores() public method

Resets the Scores for this level to 0.
public ResetScores ( ) : void
return void

Respawn() public method

Respawn the player. Reset gravity direction and clear player velocity TODO - Reset all other objects as well
public Respawn ( ) : void
return void

Update() public method

Updates the level's progress
public Update ( GameTime gameTime, GameStates &gameState ) : void
gameTime Microsoft.Xna.Framework.GameTime The game time.
gameState GameStates State of the game.
return void

UpdateParticles() public method

public UpdateParticles ( object sender, DoWorkEventArgs e ) : void
sender object
e System.ComponentModel.DoWorkEventArgs
return void

UpdateStars() public method

public UpdateStars ( ) : void
return void

Property Details

MCam public_oe static_oe property

public static Camera,MrGravity MCam
return Camera

MDeaths public_oe static_oe property

public static int MDeaths
return int

MNumCollectable public_oe static_oe property

public static int MNumCollectable
return int

MNumCollected public_oe static_oe property

public static int MNumCollected
return int

MTimer public_oe property

public double MTimer
return double