C# Класс MrGravity.Level

This class represents a level in the game
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
MCam Camera
MDeaths int
MNumCollectable int
MNumCollected int
MTimer double

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

Dispose() публичный Метод

public Dispose ( ) : void
Результат void

Draw() публичный Метод

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
Результат void

Level() публичный Метод

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
Результат System

Load() публичный Метод

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
Результат void

Load() публичный Метод

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
Результат void

MainMenuLevel() публичный статический Метод

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
Результат Level

Reload() публичный Метод

Reloads the content in this level
public Reload ( ) : void
Результат void

Reset() публичный Метод

Preps the level to reload content
public Reset ( ) : void
Результат void

ResetAll() публичный Метод

public ResetAll ( ) : void
Результат void

ResetScores() публичный Метод

Resets the Scores for this level to 0.
public ResetScores ( ) : void
Результат void

Respawn() публичный Метод

Respawn the player. Reset gravity direction and clear player velocity TODO - Reset all other objects as well
public Respawn ( ) : void
Результат void

Update() публичный Метод

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.
Результат void

UpdateParticles() публичный Метод

public UpdateParticles ( object sender, DoWorkEventArgs e ) : void
sender object
e System.ComponentModel.DoWorkEventArgs
Результат void

UpdateStars() публичный Метод

public UpdateStars ( ) : void
Результат void

Описание свойств

MCam публичное статическое свойство

public static Camera,MrGravity MCam
Результат Camera

MDeaths публичное статическое свойство

public static int MDeaths
Результат int

MNumCollectable публичное статическое свойство

public static int MNumCollectable
Результат int

MNumCollected публичное статическое свойство

public static int MNumCollected
Результат int

MTimer публичное свойство

public double MTimer
Результат double