1 | #pragma once
|
---|
2 | #include "node.h"
|
---|
3 | #include "Scene.h"
|
---|
4 | #include "Vector.h"
|
---|
5 | #include <string>
|
---|
6 | #include <vector>
|
---|
7 | #include "NxPhysics.h"
|
---|
8 | #include "ParticleCube.h"
|
---|
9 | #include "ParticleEmitter.h"
|
---|
10 |
|
---|
11 | class Player;
|
---|
12 | class Goodie;
|
---|
13 | class SoundNode;
|
---|
14 | class GameScene;
|
---|
15 |
|
---|
16 | #define SPTR boost::shared_ptr
|
---|
17 | #define WPTR boost::weak_ptr
|
---|
18 |
|
---|
19 | class Bullet :
|
---|
20 | public Node
|
---|
21 | {
|
---|
22 | public:
|
---|
23 | Bullet(void);
|
---|
24 | ~Bullet(void);
|
---|
25 |
|
---|
26 | virtual void initBullet() = 0;
|
---|
27 |
|
---|
28 | virtual void impactPlayer(Player* player, Vector normal) = 0;
|
---|
29 | virtual void impactTerrain(Vector normal) = 0;
|
---|
30 | virtual void impactGoodie(Goodie* goodie, Vector normal) = 0;
|
---|
31 | virtual void impactOther(Object3d* other, Vector normal) = 0;
|
---|
32 | virtual void impactTimeOut() = 0;
|
---|
33 |
|
---|
34 | void addParticleEmitter(ParticleEmitter *_emitter);
|
---|
35 | void addParticleCube(ParticleCube *_cube);
|
---|
36 | void startParticleEmitter();
|
---|
37 |
|
---|
38 | void setWeaponDirection(Vector _dir);
|
---|
39 | void setImpactForce(float _impactForce);
|
---|
40 | float getImpactForce();
|
---|
41 |
|
---|
42 | void setImpactRadius(float _radius);
|
---|
43 | float getImpactRadius();
|
---|
44 |
|
---|
45 | void setImpactDamage(float _impactDamage);
|
---|
46 | float getImpactDamage();
|
---|
47 |
|
---|
48 | void setFlySound(std::string flySoundName);
|
---|
49 | void setImpactSound(std::string impactSoundName);
|
---|
50 |
|
---|
51 | void setPlayer(Player* _myPlayer);
|
---|
52 |
|
---|
53 | void setBulletType(int type);
|
---|
54 | int getBulletType();
|
---|
55 |
|
---|
56 | Vector getDirection();
|
---|
57 |
|
---|
58 | void setExplodeAtDeath(bool _explodeAtDeath);
|
---|
59 |
|
---|
60 | virtual void update(float dt);
|
---|
61 | bool exploded;
|
---|
62 | Player *myPlayer;
|
---|
63 |
|
---|
64 | virtual void killMe();
|
---|
65 |
|
---|
66 | friend class GameScene;
|
---|
67 | protected:
|
---|
68 |
|
---|
69 | int bulletType;
|
---|
70 | Vector dir;
|
---|
71 | float impactForce;
|
---|
72 | float impactDamage;
|
---|
73 | float impactRadius;
|
---|
74 |
|
---|
75 | SoundNode *flySound;
|
---|
76 | SoundNode *impactSound;
|
---|
77 | bool explodeAtDeath;
|
---|
78 |
|
---|
79 | std::vector<ParticleEmitter*> particleEmitterList;
|
---|
80 | std::vector<ParticleCube*> particleCubeList;
|
---|
81 | virtual void setStandardExplosionForces();
|
---|
82 | void collectEnvironmentInformation();
|
---|
83 |
|
---|
84 | //EnvironmentInformation
|
---|
85 | std::vector<NxShape*> shapeList;
|
---|
86 | std::vector<Player*> playerList;
|
---|
87 | std::vector<Bullet*> bulletList;
|
---|
88 | std::vector<Goodie*> goodieList;
|
---|
89 | bool terrainHit;
|
---|
90 | Vector impactNormal;
|
---|
91 | };
|
---|