mElite  1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Member Functions | List of all members
SpaceShip Class Reference

Represents a space ship. More...

#include <SpaceShip.h>

Inheritance diagram for SpaceShip:
MovingObject ModelObject GameObject GraphicsObject GameObject abstract PlayerObject

Public Member Functions

 SpaceShip (float r, GLuint displayList)
 Initializes the space ship.
 
 SpaceShip (Vector3 position, float r, GLuint displayList)
 Initializes the space ship.
 
 SpaceShip (float x, float y, float z, float r, GLuint displayList)
 Initializes the space ship.
 
 ~SpaceShip (void)
 Destructor.
 
void draw ()
 Draws the object using the base class drawing method.
 
Vector3 getOriginalView (void)
 Returns the original view vector.
 
Vector3 getOriginalUp (void)
 Returns the original up vector.
 
bool isDestroyed ()
 Determines wheather a ship is destroyed or not.
 
virtual void update (float t)
 
float getLaserHeat (void)
 Returns the current heat of the laser.
 
float getMaxLaserHeat (void)
 
float getLaserPercentage (void)
 Returns the percentage of the heat of the maximal heat.
 
unsigned int getMissileCount (void)
 Returns the current amount of missiles.
 
bool isOverHeated (void)
 Returns true if the laser is overheated, otherwise false.
 
void useMissile (void)
 Shoots a missile, if possible.
 
bool isShooting ()
 
void setShoot (bool status)
 
float getBackShieldPower (void)
 Returns the current back shield power.
 
float getBackShieldPowerPercentage (void)
 Returns the current percentage of back shield power.
 
float getFrontShieldPower (void)
 Returns the current front shield power.
 
float getFrontShieldPowerPercentage (void)
 Returns the current percentage of front shield power.
 
void setShieldRecovering (bool recovers)
 
void receiveHitBack (DWORD time)
 
void receiveHitFront (DWORD time)
 
void setShieldCapacity (float capacity)
 
bool shipWasHitOnce ()
 
- Public Member Functions inherited from MovingObject
 MovingObject ()
 Constructor, initializes to the origin. The line of vision is aligned to the z axis, the up vector is aligned to the y-axis.
 
 MovingObject (Vector3 position)
 Constructor initializing to a given position as Vector3.
 
 MovingObject (float x, float y, float z)
 Constructor, the startposition is (x,y,z).
 
 ~MovingObject (void)
 Destructor.
 
void pitch (float angle)
 Pitches the line of vision.
 
void roll (float angle)
 Rolls the eye.
 
Vector3 getRight (void)
 Returns the vector indiciating what is 'right' of the eye.
 
Vector3 getUp (void)
 Returns the vector indication what is 'up'.
 
Vector3 getView (void)
 Returns the current viewing vector.
 
void setView (Vector3 v)
 Sets the current viewing vector.
 
void accelerate (float step)
 Sets the speed.
 
void advance (float t)
 Move the camera depending on the current speed and line of vision.
 
float getMaxSpeed (void)
 Returns the maximal speed.
 
float getMinSpeed (void)
 Returns the minimal speed.
 
float getSpeed (void)
 Returns the vector indicating the direction 'right'.
 
void setMaxSpeed (float speed)
 Sets the maximal speed.
 
void setMinSpeed (float speed)
 Sets the minimal speed.
 
void setSpeed (float speed)
 Sets the current speed.
 
void setStep (float step)
 Sets the value that is advanced in one step.
 
- Public Member Functions inherited from GameObject
 GameObject (void)
 The constructor creates the object. The position is set to zero by default.
 
 GameObject (Vector3 position)
 The constructor creates the object and gives it a position in the scene.
 
 GameObject (float x, float y, float z)
 The constructor creates the object and gives it a position in the scene.
 
 ~GameObject (void)
 Destructor. Does nothing.
 
virtual Vector3 getPos (void)
 Returns the current position as Vector3 triple.
 
void setPos (float x, float y, float z)
 Sets the current position.
 
void setPos (Vector3 position)
 Sets the current position.
 
- Public Member Functions inherited from ModelObject
 ModelObject (GLuint displayList)
 Creates a model object and sets up the display List.
 
 ModelObject (float r, GLuint displayList)
 Creates a model object and sets up the display List.
 
 ModelObject (Vector3 position, float r, GLuint displayList)
 Creates a model object and sets up the display List.
 
 ModelObject (float x, float y, float z, float r, GLuint displayList)
 Creates a model object and sets up the display List.
 
 ~ModelObject (void)
 The destructor has nothing to clean up.
 
- Public Member Functions inherited from GraphicsObject
 GraphicsObject (void)
 The constructor creates the object.
 
 GraphicsObject (GLfloat r)
 The constructor creates the object.
 
 GraphicsObject (Vector3 position, float r)
 Creates an graphical object.
 
 GraphicsObject (float x, float y, float z, float r)
 Creates a graphical object.
 
 ~GraphicsObject (void)
 Destructor.
 
float getRadius (void)
 Returns the radius of the object, usable for view frustum culling.
 
float getCollisionRadius (void)
 Returns the radius of the object, usable for collision detection.
 

Protected Member Functions

void advance (float t)
 
void updateLaser (float t)
 
void setLaserHeat (float heat)
 
virtual void coolLaser (DWORD time)
 Cools the laser.
 

Detailed Description

Represents a space ship.

Derived from the ModelObject class which means, the ship is drawable using the base draw() method. As a ship is movable, it inherits also from the MovingObject class. Besides that the class provides the propertys and the behavior of a space ship. It contains shooting, the shield.

Definition at line 20 of file SpaceShip.h.

Constructor & Destructor Documentation

SpaceShip::SpaceShip ( float  r,
GLuint  displayList 
)

Initializes the space ship.

The radius and the display list have to be submitted if an object is initialized. The starting position is set to the origin.

Parameters
rthe radius
displayListthe display list

Definition at line 17 of file SpaceShip.cpp.

SpaceShip::SpaceShip ( Vector3  position,
float  r,
GLuint  displayList 
)

Initializes the space ship.

The radius and the display list have to be submitted if an object is initialized.

Parameters
positionthe position as Vector3
rthe radius
displayListthe display list

Definition at line 29 of file SpaceShip.cpp.

SpaceShip::SpaceShip ( float  x,
float  y,
float  z,
float  r,
GLuint  displayList 
)

Initializes the space ship.

The radius and the display list have to be submitted if an object is initialized.

Parameters
xthe x-position
ythe y-position
zthe z-position
rthe radius
displayListthe display list

Definition at line 43 of file SpaceShip.cpp.

SpaceShip::~SpaceShip ( void  )

Destructor.

Definition at line 50 of file SpaceShip.cpp.

Member Function Documentation

void SpaceShip::advance ( float  t)
protected

Definition at line 137 of file SpaceShip.cpp.

void SpaceShip::coolLaser ( DWORD  time)
protectedvirtual

Cools the laser.

If the laser is not used, this function is called. It cools the laser until its heat is zero. This is called in the SpaceShip::advance() method.

Parameters
timethe time that has passed

Reimplemented in PlayerObject.

Definition at line 127 of file SpaceShip.cpp.

GLvoid SpaceShip::draw ( void  )
virtual

Draws the object using the base class drawing method.

Previously it is translated to the current position.

Reimplemented from ModelObject.

Definition at line 78 of file SpaceShip.cpp.

float SpaceShip::getBackShieldPower ( void  )

Returns the current back shield power.

Definition at line 230 of file SpaceShip.cpp.

float SpaceShip::getBackShieldPowerPercentage ( void  )

Returns the current percentage of back shield power.

Definition at line 237 of file SpaceShip.cpp.

float SpaceShip::getFrontShieldPower ( void  )

Returns the current front shield power.

Definition at line 244 of file SpaceShip.cpp.

float SpaceShip::getFrontShieldPowerPercentage ( void  )

Returns the current percentage of front shield power.

Definition at line 251 of file SpaceShip.cpp.

float SpaceShip::getLaserHeat ( void  )

Returns the current heat of the laser.

Definition at line 161 of file SpaceShip.cpp.

float SpaceShip::getLaserPercentage ( void  )

Returns the percentage of the heat of the maximal heat.

Definition at line 172 of file SpaceShip.cpp.

float SpaceShip::getMaxLaserHeat ( void  )

Definition at line 165 of file SpaceShip.cpp.

unsigned int SpaceShip::getMissileCount ( void  )

Returns the current amount of missiles.

Definition at line 179 of file SpaceShip.cpp.

Vector3 SpaceShip::getOriginalUp ( void  )

Returns the original up vector.

Definition at line 258 of file SpaceShip.cpp.

Vector3 SpaceShip::getOriginalView ( void  )

Returns the original view vector.

Definition at line 265 of file SpaceShip.cpp.

bool SpaceShip::isDestroyed ( )

Determines wheather a ship is destroyed or not.

If the current front or back shield power is less than zero, the ship is destroyed.

Returns
True if the ship is destroyed, false elsewise.

Definition at line 114 of file SpaceShip.cpp.

bool SpaceShip::isOverHeated ( void  )

Returns true if the laser is overheated, otherwise false.

Definition at line 186 of file SpaceShip.cpp.

bool SpaceShip::isShooting ( )

Definition at line 215 of file SpaceShip.cpp.

void SpaceShip::receiveHitBack ( DWORD  time)

Definition at line 269 of file SpaceShip.cpp.

void SpaceShip::receiveHitFront ( DWORD  time)

Definition at line 275 of file SpaceShip.cpp.

void SpaceShip::setLaserHeat ( float  heat)
protected

Definition at line 219 of file SpaceShip.cpp.

void SpaceShip::setShieldCapacity ( float  capacity)

Definition at line 293 of file SpaceShip.cpp.

void SpaceShip::setShieldRecovering ( bool  recovers)

Definition at line 303 of file SpaceShip.cpp.

void SpaceShip::setShoot ( bool  status)

Definition at line 223 of file SpaceShip.cpp.

bool SpaceShip::shipWasHitOnce ( )

Definition at line 307 of file SpaceShip.cpp.

void SpaceShip::update ( float  t)
virtual

Reimplemented in abstract.

Definition at line 149 of file SpaceShip.cpp.

void SpaceShip::updateLaser ( float  t)
protected

Definition at line 142 of file SpaceShip.cpp.

void SpaceShip::useMissile ( void  )

Shoots a missile, if possible.

Reduces the missile count by one.

Definition at line 209 of file SpaceShip.cpp.


The documentation for this class was generated from the following files: