Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/presentation/src/world_entities/weapons/bsp_weapon.h @ 10704

Last change on this file since 10704 was 10704, checked in by rennerc, 17 years ago

FPSSniperRifle uses BspWeapon now

File size: 1.8 KB
Line 
1/*
2* file bsp_weapon.h
3* A weapon that shoots both at player and environment (pnode and bsp).
4*/
5
6#ifndef _BSP_WEAPON_H
7#define _BSP_WEAPON_H
8
9#include "world_entity.h"
10#include "aiming_system.h"
11#include "effects/explosion.h"
12
13#include <list>
14
15#include "particles/box_emitter.h"
16#include "particles/sprite_particles.h"
17
18class MuzzleFlash : public WorldEntity
19{
20  ObjectListDeclaration(MuzzleFlash);
21  public:
22    void explode (float lifetime);
23
24    MuzzleFlash ();
25    virtual ~MuzzleFlash ();
26
27    virtual void activate();
28    virtual void deactivate();
29
30    virtual void tick (float time);
31    virtual void draw() const;
32
33    void setLifeTime( float lifeTime ){ this->lifeTime = lifeTime; }
34   
35    void drawParticles(){ if (explosionParticles) explosionParticles->draw(); }
36
37  protected:
38    //static FastFactory*        fastFactory;
39
40    float                      lifeTime;
41    float                      lifeCycle;
42
43    SpriteParticles*    explosionParticles;
44    BoxEmitter*                emitter;
45
46};
47
48
49class BspWeapon : public WorldEntity
50        {
51                ObjectListDeclaration(BspWeapon);
52        public:
53                BspWeapon ( OM_LIST list );
54                BspWeapon (const  TiXmlElement* root);
55                virtual ~BspWeapon();
56
57                void init( OM_LIST list );
58                void loadParams(const TiXmlElement* root);
59                void fire(bool fire){ this->bFire = fire; }
60                virtual void tick(float dt);
61                virtual void draw() const;
62
63                void setAlwaysHits( bool r ){ this->alwaysHits = r; }
64                void setDamage( float d ){ this->damage = d; }
65        private:
66
67                void shoot();
68                float range;
69                void setRange( float r ){ this->range = r; }
70                float damage;
71                float fireRate;
72                void setFireRate( float r ){ this->fireRate = r; }
73                bool alwaysHits;
74                void addPoint(float x, float y, float z);
75               
76    std::list<MuzzleFlash*> gunFire;
77
78                float bRate;
79                bool bFire;
80
81                AimingSystem* aimingSystem;
82        };
83
84#endif
Note: See TracBrowser for help on using the repository browser.