Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/main_reto_vs05/src/weapon/weapon_manager.h @ 194

Last change on this file since 194 was 194, checked in by rgrieder, 16 years ago
  • added primary and secondary fire in continuous mode
  • weapon manager yet very inflexible (one weapon, static values, etc.)
File size: 2.5 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *
4 *
5 *   License notice:
6 *
7 *   This program is free software: you can redistribute it and/or modify
8 *   it under the terms of the GNU General Public License as published by
9 *   the Free Software Foundation, either version 3 of the License, or
10 *   (at your option) any later version.
11 *
12 *   This program is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *   GNU General Public License for more details.
16 *
17 *   You should have received a copy of the GNU General Public License
18 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 *
20 *
21 *   Author:
22 *      Reto Grieder
23 *   Co-authors:
24 *      ...
25 *
26 */
27
28
29#ifndef WEAPON_MANAGER_H
30#define WEAPON_MANAGER_H
31
32#include "OgrePrerequisites.h"
33
34#include "orxonox_prerequisites.h"
35
36
37namespace orxonox {
38namespace weapon {
39
40  class WeaponManager
41  {
42  public:
43    enum Action {
44      NOTHING  = 0,
45      RELOAD   = 1,
46      CHANGE_AMMO  = 2,
47      SPECIAL  = 3
48    };
49
50  protected:
51    enum State {
52      IDLE = 0,
53      PRIMARY_FIRE = 1,
54      SECONDARY_FIRE = 2,
55      RELOADING = 3,
56      CHANGING_AMMO = 4,
57    };
58
59  public:
60    WeaponManager(Ogre::SceneManager*, InertialNode*, BulletManager*, int);
61          virtual ~WeaponManager();
62
63    bool addWeapon(const Ogre::String&);
64
65    bool addAction(const Action);
66
67    void primaryFireRequest();
68
69    void secondaryFireRequest();
70
71    bool tick(unsigned long, Ogre::Real);
72
73    bool static loadWeapons();
74
75    void static destroyWeapons();
76
77  protected:
78    void primaryFire();
79
80    void primaryFiring(unsigned int);
81
82    void secondaryFire();
83
84    void secondaryFiring(unsigned int);
85
86  public:
87
88  protected:
89    Ogre::SceneManager *sceneMgr_;
90    //Ogre::SceneNode *node_;
91    InertialNode* node_;
92
93    Weapon **slots_;
94    int slotSize_;
95    int slotIndex_;
96    int selectedWeapon_;
97
98    int bulletCounter_;
99    BulletManager *bulletManager_;
100
101    bool primaryFireRequest_;
102    bool secondaryFireRequest_;
103
104    unsigned long actionStartTime_;
105
106    State currentState_;
107    bool secondaryFired_;
108
109    Action nextAction_;
110    bool actionAdded_;
111    unsigned long timeSinceNextActionAdded_;
112    static const unsigned long nextActionValidityPeriod_ = 500;
113
114    static Weapon **weaponList_s;
115
116  };
117
118}
119}
120
121#endif /* WEAPON_MANAGER_H */
Note: See TracBrowser for help on using the repository browser.