C# Класс ScrollingShooter.PlayerShip

A base class for all Player ships
Наследование: ScrollingShooter.GameObject
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
Dead bool
DeathTimer float
Health float
HomingMissileLevel short
InvincibleFrame float
InvincibleTimer float
Kills int
Lives int
MaxHealth float
Score int
defaultGunTimer float
energyBlastLevel int
energyBlastTimer float

Защищенные свойства (Protected)

Свойство Тип Описание
position Vector2
railgunSpriteBounds Microsoft.Xna.Framework.Rectangle
spriteBounds Microsoft.Xna.Framework.Rectangle[]
spriteSheet Microsoft.Xna.Framework.Graphics.Texture2D
velocity Vector2

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

Метод Описание
ApplyPowerup ( PowerupType powerup ) : void

Applies the specified powerup to the ship

ClearPowerups ( ) : void
Draw ( float elaspedTime, SpriteBatch spriteBatch ) : void

Draw the ship on-screen

EndLevel ( float elaspedTime ) : void
GetPosition ( ) : Vector2
MoveShip ( Vector2 direction ) : void
PlayerShip ( uint id, Microsoft.Xna.Framework.Content.ContentManager content ) : System

Creates a new Player ship instance and initializes sound effects

ScrollWithMap ( float elapsedTime ) : void

Scrolls the object with the map

Update ( float elapsedTime ) : void

Updates the ship

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

Метод Описание
ApplyBlades ( ) : void

A helper function that initializes the blades powerup. //Puts a giant spinning blade over player position and doubles the players velocity.

ApplyTriShield ( ) : void

A helper function that initializes the tri-shield. Creates three trishield balls.

GetDrunk ( ) : void

Makes the player drunk. If the player is already drunk the player is just made drunk for longer. The drunk counter is increased by a random number. Time to be drunk is between 5 and 10 seconds.

SoberUp ( ) : void

Makes the player sober. Activated when the drunk time has run out.

TriggerBirdcrap ( ) : void

A helper that fires birdcrap from the ship. Coraspondes to the birdcrap power up.

TriggerBomb ( ) : void
TriggerDroneWave ( ) : void

A helper function that fires a wide drone wave from the ship, corresponding to the fireball powerup.

TriggerEightBallShield ( ) : void

Helper function to create an eightballshield around the ship

TriggerEnergyBlast ( ) : void

A helper function that fires an energy blast from the ship, corresponding to the energy blast powerup

TriggerFireball ( ) : void

A helper function that fires a fireball from the ship, corresponding to the fireball powerup

TriggerFrostball ( ) : void

A helper function that fires a frostball from the ship, corresponding to the frostball powerup

TriggerHomingMissile ( ) : void

Handles the firing of a homing missile

TriggerMeteor ( ) : void

A helper function that starts a meteor storm, corresponding to the meteor powerup

TriggerRailgun ( ) : void

Fires the railgun sabot round from the ship, corresponding to the railgun powerup

TriggerShotgun ( ) : void

A helper function that shoots a spray shot from the ship when the spray shot powerup is active

unApplyBlades ( ) : void

A helper function that will remove the Blade powerup and restore defaults.

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

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

Applies the specified powerup to the ship
public ApplyPowerup ( PowerupType powerup ) : void
powerup PowerupType the indicated powerup
Результат void

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

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

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

Draw the ship on-screen
public Draw ( float elaspedTime, SpriteBatch spriteBatch ) : void
elaspedTime float The elapsed time
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch An already-initialized spritebatch, ready for Draw() commands
Результат void

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

public EndLevel ( float elaspedTime ) : void
elaspedTime float
Результат void

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

public GetPosition ( ) : Vector2
Результат Vector2

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

public MoveShip ( Vector2 direction ) : void
direction Vector2
Результат void

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

Creates a new Player ship instance and initializes sound effects
public PlayerShip ( uint id, Microsoft.Xna.Framework.Content.ContentManager content ) : System
id uint the unique id of the Player ship
content Microsoft.Xna.Framework.Content.ContentManager
Результат System

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

Scrolls the object with the map
public ScrollWithMap ( float elapsedTime ) : void
elapsedTime float The in-game time between the previous and current frame
Результат void

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

Updates the ship
public Update ( float elapsedTime ) : void
elapsedTime float
Результат void

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

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

Player's alive-ness
public bool Dead
Результат bool

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

Player's death timer
public float DeathTimer
Результат float

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

Player's Health
public float Health
Результат float

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

public static short HomingMissileLevel
Результат short

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

Player's invincible frame
public float InvincibleFrame
Результат float

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

Player's invincible timer
public float InvincibleTimer
Результат float

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

Player's Kill count
public int Kills
Результат int

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

Player's Lives
public int Lives
Результат int

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

Player's Max Health
public float MaxHealth
Результат float

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

Player's Score
public int Score
Результат int

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

Timer for the default gun
public float defaultGunTimer
Результат float

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

Level of the energy blast powerup
public int energyBlastLevel
Результат int

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

Timer for the energy blast gun
public float energyBlastTimer
Результат float

position защищенное свойство

The position of the ship in the game world. We use a Vector2 for position rather than a Rectangle, as floats allow us to move less than a pixel
protected Vector2 position
Результат Vector2

railgunSpriteBounds защищенное свойство

Rectangle to draw the railgun when the powerup is enabled
protected Rectangle,Microsoft.Xna.Framework railgunSpriteBounds
Результат Microsoft.Xna.Framework.Rectangle

spriteBounds защищенное свойство

The spritebounds for our ship, corresponding to the five possible steering states
protected Rectangle[],Microsoft.Xna.Framework spriteBounds
Результат Microsoft.Xna.Framework.Rectangle[]

spriteSheet защищенное свойство

The spritesheet our ship is found upon
protected Texture2D,Microsoft.Xna.Framework.Graphics spriteSheet
Результат Microsoft.Xna.Framework.Graphics.Texture2D

velocity защищенное свойство

The velocity of the ship - varies from ship to ship
protected Vector2 velocity
Результат Vector2