[190] | 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 | |
---|
| 37 | namespace orxonox { |
---|
| 38 | namespace weapon { |
---|
| 39 | |
---|
| 40 | class WeaponManager |
---|
| 41 | { |
---|
| 42 | public: |
---|
| 43 | enum Action { |
---|
| 44 | NOTHING = 0, |
---|
| 45 | RELOAD = 1, |
---|
| 46 | ZOOM_IN = 2, |
---|
| 47 | ZOOM_OUT = 3 |
---|
| 48 | }; |
---|
| 49 | |
---|
| 50 | protected: |
---|
| 51 | enum State { |
---|
| 52 | IDLE = 0, |
---|
| 53 | PRIMARY_FIRE = 1, |
---|
| 54 | SECONDARY_FIRE = 2, |
---|
| 55 | RELOADING = 4 |
---|
| 56 | }; |
---|
| 57 | |
---|
| 58 | public: |
---|
| 59 | WeaponManager(Ogre::SceneManager*, InertialNode*, BulletManager*, int); |
---|
| 60 | virtual ~WeaponManager(); |
---|
| 61 | |
---|
| 62 | bool addWeapon(const Ogre::String&); |
---|
| 63 | |
---|
| 64 | bool addAction(const Action); |
---|
| 65 | |
---|
| 66 | void primaryFireRequest(); |
---|
| 67 | |
---|
| 68 | void secondaryFireRequest(); |
---|
| 69 | |
---|
| 70 | bool tick(unsigned long, Ogre::Real); |
---|
| 71 | |
---|
| 72 | bool static loadWeapons(); |
---|
| 73 | |
---|
| 74 | void static destroyWeapons(); |
---|
| 75 | |
---|
| 76 | protected: |
---|
| 77 | void primaryFire(); |
---|
| 78 | |
---|
| 79 | void secondaryFire(); |
---|
| 80 | |
---|
| 81 | public: |
---|
| 82 | |
---|
| 83 | protected: |
---|
| 84 | Ogre::SceneManager *sceneMgr_; |
---|
| 85 | //Ogre::SceneNode *node_; |
---|
| 86 | InertialNode* node_; |
---|
| 87 | |
---|
| 88 | Weapon **slots_; |
---|
| 89 | int slotSize_; |
---|
| 90 | int slotIndex_; |
---|
| 91 | int selectedWeapon_; |
---|
| 92 | |
---|
| 93 | int bulletCounter_; |
---|
| 94 | BulletManager *bulletManager_; |
---|
| 95 | |
---|
| 96 | bool primaryFireRequest_; |
---|
| 97 | bool secondaryFireRequest_; |
---|
| 98 | |
---|
| 99 | State currentState_; |
---|
| 100 | |
---|
| 101 | Action *actionList_; |
---|
| 102 | int actionListReadIndex_; |
---|
| 103 | int actionListWriteIndex_; |
---|
| 104 | |
---|
| 105 | static Weapon **weaponList_s; |
---|
| 106 | |
---|
| 107 | }; |
---|
| 108 | |
---|
| 109 | } |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | #endif /* WEAPON_MANAGER_H */ |
---|