C# 클래스 EtherDuels.Game.GameController

The GameController is responsible for the communication between the GameModel and its GameView. It creates new worlds and its views via a GameBuilder and can remove and add objects to them. It also observes whether a game has ended or was paused and informs its GameHandler if necessary.
상속: CollisionHandler, PlayerHandler
파일 보기 프로젝트 열기: julius/pse_spacewar

공개 메소드들

메소드 설명
CreateGame ( ) : void

Creates a new game using its dedicated GameBuilder. A game consists of a model and its view.

Draw ( Viewport viewPort, SpriteBatch spriteBatch, GameTime gameTime ) : void

Draws the GameView and all its subcomponents.

GameController ( GameBuilder gameBuilder, GameHandler gameHandler ) : System

Constructor of a GameController object.

OnCollision ( WorldObject collisionObject1, WorldObject collisionObject2 ) : void

Reacts to a collision that happend in the game depending on the type of the two assigned WorldObjects. This method creates an explosion, reduces the health of the WorldObject, if necessary, and checks, if one of the involved world objects has to be removed from the world.

OnFire ( Spaceship shooter ) : void

Creates a projectile and its fitting view.

Update ( FrameState frameState ) : void

Updates the GameModel and its subcomponents.

비공개 메소드들

메소드 설명
checkDeath ( WorldObject collisionObject, WorldObjectView worldObjectViews ) : void

메소드 상세

CreateGame() 공개 메소드

Creates a new game using its dedicated GameBuilder. A game consists of a model and its view.
public CreateGame ( ) : void
리턴 void

Draw() 공개 메소드

Draws the GameView and all its subcomponents.
public Draw ( Viewport viewPort, SpriteBatch spriteBatch, GameTime gameTime ) : void
viewPort Microsoft.Xna.Framework.Graphics.Viewport Defines the Viewport to usw.
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch Defines the SpriteBatch to use.
gameTime Microsoft.Xna.Framework.GameTime The frame's time object.
리턴 void

GameController() 공개 메소드

Constructor of a GameController object.
public GameController ( GameBuilder gameBuilder, GameHandler gameHandler ) : System
gameBuilder GameBuilder Defines the GameBuilder the GameController uses.
gameHandler GameHandler Defines the GameHandler the GameController uses.
리턴 System

OnCollision() 공개 메소드

Reacts to a collision that happend in the game depending on the type of the two assigned WorldObjects. This method creates an explosion, reduces the health of the WorldObject, if necessary, and checks, if one of the involved world objects has to be removed from the world.
public OnCollision ( WorldObject collisionObject1, WorldObject collisionObject2 ) : void
collisionObject1 EtherDuels.Game.Model.WorldObject The first WorldObject, which was involved in the collision.
collisionObject2 EtherDuels.Game.Model.WorldObject The second WorldObject, which was involved in the collision.
리턴 void

OnFire() 공개 메소드

Creates a projectile and its fitting view.
public OnFire ( Spaceship shooter ) : void
shooter Spaceship The Spaceship which fired the projectile.
리턴 void

Update() 공개 메소드

Updates the GameModel and its subcomponents.
public Update ( FrameState frameState ) : void
frameState FrameState
리턴 void