C# Class MyGame.BulletsManager

This class represent the bullet manager that manages creating and calling updates on bullets, also removing bullet at collision detected.
Inheritance: Microsoft.Xna.Framework.DrawableGameComponent, IEvent
ファイルを表示 Open project: mahmoudbahaa/XNA-Game-project Class Usage Examples

Protected Properties

Property Type Description
events List

Public Methods

Method Description
AddBullet ( Vector3 position, Vector3 rotation, Vector3 direction ) : void

Add a new bullet at the specified position, rotation and direction

BulletsManager ( MyGame game ) : System

Constructor that initialize the bullet manager

Draw ( GameTime gameTime ) : void

This method renders the current state.

Update ( GameTime gameTime ) : void

Allows the component to run logic.

addEvent ( Event ev ) : void

Add event to the event queue

Protected Methods

Method Description
FireShots ( ) : void

Fire a new bullet if the specified event(C_ATTACK_BULLET_END) was received

UpdateShots ( GameTime gameTime ) : void

update the bullet if the bulltet out of range or collide with the monster remove it

Method Details

AddBullet() public method

Add a new bullet at the specified position, rotation and direction
public AddBullet ( Vector3 position, Vector3 rotation, Vector3 direction ) : void
position Vector3 initial position of the new bullet
rotation Vector3 rotation of the new bullet
direction Vector3 Direction in which the bullet will move
return void

BulletsManager() public method

Constructor that initialize the bullet manager
public BulletsManager ( MyGame game ) : System
game MyGame Instance of MyGame this game component is attached to
return System

Draw() public method

This method renders the current state.
public Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime The elapsed game time.
return void

FireShots() protected method

Fire a new bullet if the specified event(C_ATTACK_BULLET_END) was received
protected FireShots ( ) : void
return void

Update() public method

Allows the component to run logic.
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime The gametime.
return void

UpdateShots() protected method

update the bullet if the bulltet out of range or collide with the monster remove it
protected UpdateShots ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime The game time
return void

addEvent() public method

Add event to the event queue
public addEvent ( Event ev ) : void
ev Event Event to be added
return void

Property Details

events protected_oe property

protected List events
return List