C# Class PantheonPrototype.Weapon

A basic implementation of a weapon inheriting from Item. As more weapons are added, the specific logic of the weapon should be moved to a subclass and this should be a parent of all weapons.
Inheritance: Item
Exibir arquivo Open project: Bacon41/PantheonPrototype

Protected Properties

Property Type Description
bulletType String
currentAmmo int
damage int
fireRate float
offset double
range int
reloadDelay System.TimeSpan
reloading bool
speed int
totalAmmo int

Public Methods

Method Description
PercentToEndReload ( ) : float
Reload ( GameTime gameTime ) : void

The method to start the reloading procudure.

Update ( GameTime gameTime, Pantheon gameReference ) : void

Updates the weapon, taking care for cooldown and other time sensitive functions.

Weapon ( Microsoft.Xna.Framework.Graphics.Texture2D texture ) : System

Initializes key values of a weapon.

activate ( Pantheon gameReference, CharacterEntity holder ) : void

Shoot the weapon. That's what this game is really about, right? Also, we need to rethink the way that shooting works right now. Eventually, I think that the Character Entity class needs an aiming point. This makes it so both Enemies and Players can use weapons.

Private Methods

Method Description
shootABullet ( Pantheon gameReference, CharacterEntity holder ) : void

Shoots a bullet.

Method Details

PercentToEndReload() public method

public PercentToEndReload ( ) : float
return float

Reload() public method

The method to start the reloading procudure.
public Reload ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime Time since last call.
return void

Update() public method

Updates the weapon, taking care for cooldown and other time sensitive functions.
public Update ( GameTime gameTime, Pantheon gameReference ) : void
gameTime Microsoft.Xna.Framework.GameTime The current game time.
gameReference Pantheon A reference to the entire game.
return void

Weapon() public method

Initializes key values of a weapon.
public Weapon ( Microsoft.Xna.Framework.Graphics.Texture2D texture ) : System
texture Microsoft.Xna.Framework.Graphics.Texture2D
return System

activate() public method

Shoot the weapon. That's what this game is really about, right? Also, we need to rethink the way that shooting works right now. Eventually, I think that the Character Entity class needs an aiming point. This makes it so both Enemies and Players can use weapons.
public activate ( Pantheon gameReference, CharacterEntity holder ) : void
gameReference Pantheon A reference so we can see where everything is.
holder CharacterEntity A reference to the character holding the weapon.
return void

Property Details

bulletType protected_oe property

protected String bulletType
return String

currentAmmo protected_oe property

The current amount of ammunition available to the player.
protected int currentAmmo
return int

damage protected_oe property

protected int damage
return int

fireRate protected_oe property

The rate of fire of the gun as the number of shots per second.
protected float fireRate
return float

offset protected_oe property

This is hacky but it works... and it's due tomorrow; So ya.
protected double offset
return double

range protected_oe property

The distance that the bullet can travel.
protected int range
return int

reloadDelay protected_oe property

protected TimeSpan,System reloadDelay
return System.TimeSpan

reloading protected_oe property

protected bool reloading
return bool

speed protected_oe property

protected int speed
return int

totalAmmo protected_oe property

The total amount of ammunition available to the player.
protected int totalAmmo
return int