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 mainFrequency, float seedTime) { this->mainFrequency = mainFrequency; |
---|
41 | this->flashFrequency = mainFrequency; |
---|
42 | this->seedTime = seedTime; } |
---|
43 | inline void setFlashConstTime(float flashConstTime) { this->flashConstTime = flashConstTime; } |
---|
44 | inline void setFlashRisingTime(float flashRisingTime) { if(flashRisingTime > this->flashConstTime) |
---|
45 | this->flashRisingTime = this->flashConstTime/2; |
---|
46 | else |
---|
47 | this->flashRisingTime = flashRisingTime; } |
---|
48 | inline void setFlashSeed(float seedX, float seedZ) { this->seedX = seedX; |
---|
49 | this->seedZ = seedZ; } |
---|
50 | |
---|
51 | void activateLightening() { this->activate(); } |
---|
52 | void deactivateLightening() { this->deactivate(); } |
---|
53 | |
---|
54 | private: |
---|
55 | Billboard* billboard[4]; |
---|
56 | bool lighteningActivate; |
---|
57 | |
---|
58 | float flashFrequency; |
---|
59 | float mainFrequency; |
---|
60 | float flashConstTime; |
---|
61 | float flashRisingTime; |
---|
62 | |
---|
63 | float time; |
---|
64 | |
---|
65 | bool bNewCoordinate; |
---|
66 | float width; |
---|
67 | float height; |
---|
68 | float seedWidth; |
---|
69 | float seedHeight; |
---|
70 | |
---|
71 | float seedX; |
---|
72 | float seedZ; |
---|
73 | float seedTime; |
---|
74 | |
---|
75 | float mainPosX; |
---|
76 | float mainPosY; |
---|
77 | float mainPosZ; |
---|
78 | |
---|
79 | Light* flashLight; |
---|
80 | |
---|
81 | //OrxSound::SoundSource soundSource; |
---|
82 | //OrxSound::SoundBuffer* thunderBuffer; |
---|
83 | |
---|
84 | }; |
---|
85 | |
---|
86 | #endif /* _LIGHTENING_EFFECT */ |
---|