1 #ifndef BEAM_EFFECT_H 2 #define BEAM_EFFECT_H 3 4 #include "spaceObject.h" 5 #include "glObjects.h" 6 7 class BeamEffect : public SpaceObject, public Updatable 8 { 9 float lifetime; 10 int32_t sourceId; 11 int32_t target_id; 12 sf::Vector3f sourceOffset; 13 sf::Vector3f targetOffset; 14 sf::Vector2f targetLocation; 15 sf::Vector3f hitNormal; 16 public: 17 bool fire_ring; 18 string beam_texture; 19 string beam_fire_sound; 20 float beam_fire_sound_power; 21 BeamEffect(); 22 virtual ~BeamEffect(); 23 24 #if FEATURE_3D_RENDERING 25 virtual void draw3DTransparent(); 26 #endif 27 virtual void update(float delta); 28 29 void setSource(P<SpaceObject> source, sf::Vector3f offset); 30 void setTarget(P<SpaceObject> target, sf::Vector2f hitLocation); 31 32 ///Set the texture used for this beam. Default is beam_orange.png setTexture(string texture)33 void setTexture(string texture) {this->beam_texture = texture;} 34 ///Set the sound played when firing the beam. Default firing sound is sfx/laser_fire.wav setBeamFireSound(string sound)35 void setBeamFireSound(string sound) {this->beam_fire_sound = sound;} 36 ///Control volume and pitch of firing sound. Default is 1.0, ships use beam damage/6 setBeamFireSoundPower(float power)37 void setBeamFireSoundPower(float power) {this->beam_fire_sound_power = power;} 38 ///Control Duration of the beam. Default is 1 second setDuration(float duration)39 void setDuration(float duration) {this->lifetime = duration;} setRing(bool ring)40 void setRing(bool ring) {this->fire_ring = ring;} 41 protected: 42 bool beam_sound_played; 43 }; 44 45 #endif//BEAM_EFFECT_H 46