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
SpaceShip.h
Go to the documentation of this file.
1 
6 #pragma once
7 #include "GlobalGL.h"
8 #include "MovingObject.h"
9 #include "ModelObject.h"
10 #include "ObjectLoader3ds.h"
11 #include "Vector3.h"
12 
14 
20 class SpaceShip :
21  virtual public MovingObject, public ModelObject {
22  // constructor, needs a display list
23 public:
24  SpaceShip( float r, GLuint displayList );
25  SpaceShip( Vector3 position, float r, GLuint displayList );
26  SpaceShip( float x, float y, float z, float r, GLuint displayList );
27  ~SpaceShip(void);
28 private:
29  void initialize();
30 
31  // draw the ship
32 public:
33  void draw();
34  Vector3 getOriginalView( void );
35  Vector3 getOriginalUp( void );
36  bool isDestroyed();
37 private:
38  Vector3 originalView;
39  Vector3 originalUp;
40 
41  // updating
42 protected:
43  void advance( float t );
44  void updateLaser( float t );
45 public:
46  virtual void update( float t);
47 
48  // shooting with laser and missiles
49 public:
50  float getLaserHeat( void );
51  float getMaxLaserHeat( void );
52  float getLaserPercentage( void );
53  unsigned int getMissileCount( void );
54  bool isOverHeated( void );
55  void useMissile( void );
56  bool isShooting();
57  void setShoot(bool status);
58 protected:
59  void setLaserHeat( float heat );
60  virtual void coolLaser( DWORD time );
61 private:
62  void useLaser( DWORD time );
63  int heatPunishTime;
64  float m_laserHeat;
65  unsigned int m_maxLaserHeat;
66  unsigned int m_maxMissiles;
67  unsigned int m_missiles;
68  bool m_overHeated;
69  bool m_ship_was_hit;
70 
71  // the shield
72 public:
73  float getBackShieldPower( void );
74  float getBackShieldPowerPercentage( void );
75  float getFrontShieldPower( void );
76  float getFrontShieldPowerPercentage( void );
77  void setShieldRecovering( bool recovers );
78  void receiveHitBack( DWORD time );
79  void receiveHitFront( DWORD time );
80  void setShieldCapacity( float capacity );
81  bool shipWasHitOnce();
82 private:
83  void recoverShieldBack( DWORD time );
84  void recoverShieldFront( DWORD time );
85  float m_backShieldPower;
86  float m_frontShieldPower;
87  float m_maxShieldPower;
88  bool shooting;
89  bool m_shieldRecovers;
90 };