File: BossManager.h

package info (click to toggle)
transcend 0.3.dfsg2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, jessie, jessie-kfreebsd, stretch
  • size: 5,796 kB
  • ctags: 3,074
  • sloc: cpp: 26,886; ansic: 693; sh: 210; makefile: 99; perl: 67
file content (228 lines) | stat: -rw-r--r-- 6,864 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/*
 * Modification History
 *
 * 2004-June-29   Jason Rohrer
 * Created.
 *
 * 2004-August-19   Jason Rohrer
 * Added explosion sounds.
 *
 * 2004-August-24   Jason Rohrer
 * Added extra parameter for distance from ship.
 *
 * 2004-August-25   Jason Rohrer
 * Added function to check for boss death.
 *
 * 2005-August-22   Jason Rohrer
 * Started work on boss damage graphics.
 */



#ifndef BOSS_MANAGER_INCLUDED
#define BOSS_MANAGER_INCLUDED



#include "Enemy.h"
#include "ShipBulletManager.h"
#include "SoundPlayer.h"
#include "BulletSound.h"

#include "minorGems/util/SimpleVector.h"
#include "minorGems/math/geometry/Vector3D.h"
#include "minorGems/math/geometry/Angle3D.h"



/**
 * A class that manages and draws all enemies in the environment.
 *
 * @author Jason Rohrer.
 */
class BossManager {


    public:


        
        /**
         * Constructs a manager.
         *
         * @param inBossTemplate the class to use to draw all enemies.
         *   Will be destroyed by this class.
         * @param inBossScale the value to multiply boss size by.
         * @param inExplosionScale the value to multiply explosion size by.
         * @param inExplosionTimeInSeconds the time it takes the explosion
         *   to complete.
         * @param inExplosionShapeParameter the parameter that controls
         *   explosion shape, in [0,1].
         * @param inBossMinVelocity the minimum speed of the boss.
         * @param inBossMaxVelocity the maximum speed of the boss.
         * @param inShipBulletManager the ship bullet manager.
         *   Must be destroyed by caller after this class is destroyed.
         * @param inBossBulletManager the boss bullet manager.
         *   Must be destroyed by caller after this class is destroyed.
         * @param inBossDamageManager the manager for boss damage objects.
         *   Must be destroyed by caller after this class is destroyed.
         * @param inBossBulletRange the range of boss bullets.
         * @param inBossBulletVelocity the velocity of boss bullets.
         * @param inMinBossBulletsPerSecond the minimum number of bullets a
         *   boss can fire per second.
         * @param inMaxBossBulletsPerSecond the maximum number of bullets a
         *   boss can fire per second.
         * @param inBossDamageTime how long each damage object is displayed
         *   in seconds.
         * @param inTimeUntilFullShootingPower how long the ship has to
         *   be in range before the boss reaches its full shooting power.
         * @param inMaxBossHealth the maximum health level of the boss.
         * @param inBossHealthRecoveryRate how fast the boss recovers health.
         * @param inBossPosition the position of the boss.
         *   Will be destroyed when this class is destroyed.
         * @param inSoundPlayer the player to send boss sounds to.
         *   Must be destroyed by caller after this class is destroyed.
         * @param inBossExplosionSoundTemplate the class to use to play
         *   boss explosion sounds.
         *   Will be destroyed by this class.
         */
        BossManager( Enemy *inBossTemplate,
                     double inBossScale,
                     double inExplosionScale,
                     double inExplosionTimeInSeconds,
                     double inExplosionShapeParameter,
                     double inBossMinVelocity,
                     double inBossMaxVelocity,
                     ShipBulletManager *inShipBulletManager,
                     ShipBulletManager *inBossBulletManager,
                     ShipBulletManager *inBossDamageManager,
                     double inBossBulletRange,
                     double inBossBulletBaseVelocity,
                     double inMinBossBulletsPerSecond,
                     double inMaxBossBulletsPerSecond,
                     double inBossDamageTime,
                     double inTimeUntilFullShootingPower,
                     double inMaxBossHealth,
                     double inBossHealthRecoveryRate,
                     Vector3D *inBossPosition,
                     SoundPlayer *inSoundPlayer,
                     BulletSound *inBossExplosionSoundTemplate );


        
        virtual ~BossManager();



        /**
         * Tell this manager that time has passed.
         *
         * @param inTimeDeltaInSeconds the amount of time that has passed.
         * @param inShipPosition the position of the ship (boss shoots
         *   toward it).
         *   Must be destroyed by caller.
         * @param inShipVelocity the velocity of the ship (boss compensates
         *   shooting aim).
         *   Must be destroyed by caller.
         */
        void passTime( double inTimeDeltaInSeconds,
                       Vector3D *inShipPosition,
                       Vector3D *inShipVelocity );

        
        
        /**
         * Gets drawable objects for the boss.
         *
         * @return boss as a collection of drawable objects.
         *   Vector and objects must be destroyed by caller.
         */
        SimpleVector<DrawableObject *> *getDrawableObjects();



        /**
         * Gets the position of the boss.
         *
         * @return the position.
         *   Must be destroyed by caller.
         */
        Vector3D *getBossPosition();



        /**
         * Gets whether the boss is dead (explosion complete).
         *
         * @return true if the boss is dead.
         */
        char isBossDead();


        
    protected:

        Enemy *mBossTemplate;
        
        ShipBulletManager *mShipBulletManager;
        ShipBulletManager *mBossBulletManager;
        ShipBulletManager *mBossDamageManager;

        double mBossScale;
        double mExplosionScale;
        double mExplosionTimeInSeconds;
        double mExplosionShapeParameter;

        double mBossMinVelocity;
        double mBossMaxVelocity;
            
        
        double mBossBulletRange;
        double mBossBulletBaseVelocity;

        double mMinBossTimeBetweenBullets;
        double mMaxBossTimeBetweenBullets;

        double mBossDamageTime;
        
        double mTimeUntilFullShootingPower;

        double mMaxBossHealth;
        double mBossHealth;

        double mHealthRecoveryRate;

        Vector3D *mBossPosition;


        
        SoundPlayer *mSoundPlayer;
        BulletSound *mBossExplosionSoundTemplate;

        
        double mBossDistanceFromCenter;
        
        
        char mCurrentlyExploding;

        
        double mExplosionProgress;
        double mExplosionFadeProgress;

        double mTimeSinceLastBullet;

        double mTimeSinceShipEnteredRange;
        double mAngerLevel;
        
        double mCurrentRadius;

        double mCurrentRotationRate;
        Angle3D *mCurrentRotation;

        double mShipDistanceParameter;
        
    };



#endif