1 | /** |
---|
2 | * @file lightening_effect.h |
---|
3 | */ |
---|
4 | |
---|
5 | #ifndef _LIGHTENING_EFFECT |
---|
6 | #define _LIGHTENING_EFFECT |
---|
7 | |
---|
8 | #include "vector.h" |
---|
9 | #include "vector2D.h" |
---|
10 | |
---|
11 | #include "weather_effect.h" |
---|
12 | |
---|
13 | #include "sound_buffer.h" |
---|
14 | #include "sound_source.h" |
---|
15 | |
---|
16 | |
---|
17 | class Billboard; |
---|
18 | class Light; |
---|
19 | |
---|
20 | class LighteningEffect : public WeatherEffect |
---|
21 | { |
---|
22 | public: |
---|
23 | LighteningEffect(const TiXmlElement* root = NULL); |
---|
24 | virtual ~LighteningEffect(); |
---|
25 | |
---|
26 | virtual void loadParams(const TiXmlElement* root); |
---|
27 | |
---|
28 | virtual bool init(); |
---|
29 | |
---|
30 | virtual bool activate(); |
---|
31 | virtual bool deactivate(); |
---|
32 | |
---|
33 | virtual void draw() const; |
---|
34 | virtual void tick(float dt); |
---|
35 | |
---|
36 | void coord(float x, float y, float z); |
---|
37 | void setFlashSize(float width, float height, float seedWidth, float seedHeight); |
---|
38 | |
---|
39 | inline void setLighteningOption(const std::string& option) { if (option == "activate") this->lighteningActivate = true;} |
---|
40 | inline void setFlashFrequency(float flashFrequency) { this->flashFrequency = flashFrequency; } |
---|
41 | inline void setFlashConstTime(float flashConstTime) { this->flashConstTime = flashConstTime; } |
---|
42 | inline void setFlashRisingTime(float flashRisingTime) { if(flashRisingTime > this->flashConstTime) |
---|
43 | this->flashRisingTime = this->flashConstTime/2; |
---|
44 | else |
---|
45 | this->flashRisingTime = flashRisingTime; } |
---|
46 | inline void setFlashSeed(float seedX, float seedZ, float seedTime) { this->seedX = seedX; |
---|
47 | this->seedZ = seedZ; |
---|
48 | this->seedTime = seedTime; } |
---|
49 | |
---|
50 | void activateLightening() { this->activate(); } |
---|
51 | void deactivateLightening() { this->deactivate(); } |
---|
52 | |
---|
53 | private: |
---|
54 | Billboard* billboard[4]; |
---|
55 | bool lighteningActivate; |
---|
56 | |
---|
57 | float flashFrequency; |
---|
58 | float flashConstTime; |
---|
59 | float flashRisingTime; |
---|
60 | |
---|
61 | float time; |
---|
62 | |
---|
63 | bool bNewCoordinate; |
---|
64 | float width; |
---|
65 | float height; |
---|
66 | float seedWidth; |
---|
67 | float seedHeight; |
---|
68 | |
---|
69 | float seedX; |
---|
70 | float seedZ; |
---|
71 | float seedTime; |
---|
72 | |
---|
73 | float mainPosX; |
---|
74 | float mainPosY; |
---|
75 | float mainPosZ; |
---|
76 | |
---|
77 | Light* flashLight; |
---|
78 | |
---|
79 | //OrxSound::SoundSource soundSource; |
---|
80 | //OrxSound::SoundBuffer* thunderBuffer; |
---|
81 | |
---|
82 | }; |
---|
83 | |
---|
84 | #endif /* _LIGHTENING_EFFECT */ |
---|