| 1 | /* | 
|---|
| 2 | *   ORXONOX - the hottest 3D action shooter ever to exist | 
|---|
| 3 | *                    > www.orxonox.net < | 
|---|
| 4 | * | 
|---|
| 5 | * | 
|---|
| 6 | *   License notice: | 
|---|
| 7 | * | 
|---|
| 8 | *   This program is free software; you can redistribute it and/or | 
|---|
| 9 | *   modify it under the terms of the GNU General Public License | 
|---|
| 10 | *   as published by the Free Software Foundation; either version 2 | 
|---|
| 11 | *   of the License, or (at your option) any later version. | 
|---|
| 12 | * | 
|---|
| 13 | *   This program is distributed in the hope that it will be useful, | 
|---|
| 14 | *   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 15 | *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 16 | *   GNU General Public License for more details. | 
|---|
| 17 | * | 
|---|
| 18 | *   You should have received a copy of the GNU General Public License | 
|---|
| 19 | *   along with this program; if not, write to the Free Software | 
|---|
| 20 | *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | 
|---|
| 21 | * | 
|---|
| 22 | *   Author: | 
|---|
| 23 | *      Jannis Holzer | 
|---|
| 24 | *      Fabien Vultier | 
|---|
| 25 | *   Co-authors: | 
|---|
| 26 | *      ... | 
|---|
| 27 | * | 
|---|
| 28 | */ | 
|---|
| 29 |  | 
|---|
| 30 | /** | 
|---|
| 31 | @file MineProjectile.h | 
|---|
| 32 | @brief Definition of the MineProjectile class. | 
|---|
| 33 | */ | 
|---|
| 34 |  | 
|---|
| 35 | #ifndef _MineProjectile_H__ | 
|---|
| 36 | #define _MineProjectile_H__ | 
|---|
| 37 |  | 
|---|
| 38 | #include "weapons/WeaponsPrereqs.h" | 
|---|
| 39 | #include "tools/Timer.h" | 
|---|
| 40 | #include "worldentities/MovableEntity.h" | 
|---|
| 41 | #include "objects/collisionshapes/SphereCollisionShape.h" | 
|---|
| 42 | #include "objects/triggers/DistanceTrigger.h" | 
|---|
| 43 | #include "BasicProjectile.h" | 
|---|
| 44 |  | 
|---|
| 45 | namespace orxonox | 
|---|
| 46 | { | 
|---|
| 47 |  | 
|---|
| 48 | /** | 
|---|
| 49 | @brief | 
|---|
| 50 | TODO | 
|---|
| 51 | @ingroup WeaponsProjectiles | 
|---|
| 52 | */ | 
|---|
| 53 | class _WeaponsExport MineProjectile : public MovableEntity, public BasicProjectile | 
|---|
| 54 | { | 
|---|
| 55 | public: | 
|---|
| 56 | MineProjectile(Context* context); | 
|---|
| 57 | virtual ~MineProjectile(); | 
|---|
| 58 |  | 
|---|
| 59 | virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; | 
|---|
| 60 |  | 
|---|
| 61 | void setMaxTimeUntilExplosion(float maxTimeUntilExplosion); | 
|---|
| 62 | void setTimeUntilActivation(float timeUntilActivation); | 
|---|
| 63 | protected: | 
|---|
| 64 | static const float triggerRadius_; | 
|---|
| 65 | static const float damageRadius_; | 
|---|
| 66 | static const float collisionShapeRadius_; | 
|---|
| 67 | private: | 
|---|
| 68 | bool bAllowExplosion_; // The mine can only explode if it is active | 
|---|
| 69 | float maxTimeUntilExplosion_; | 
|---|
| 70 | float timeUntilActivation_; | 
|---|
| 71 | Timer activationTimer_; | 
|---|
| 72 | Timer explodeTimer_; | 
|---|
| 73 | Model* modelCore_; | 
|---|
| 74 | Model* modelRing1_; | 
|---|
| 75 | Model* modelRing2_; | 
|---|
| 76 | Model* modelRing3_; | 
|---|
| 77 | Model* modelRing4_; | 
|---|
| 78 | MovableEntity* rings1_; | 
|---|
| 79 | MovableEntity* rings2_; | 
|---|
| 80 | MovableEntity* core_; | 
|---|
| 81 | ParticleEmitter* emitter_; | 
|---|
| 82 |  | 
|---|
| 83 | WeakPtr<SphereCollisionShape> collisionShape_; // The collision shape of the projectile. | 
|---|
| 84 | WeakPtr<DistanceTrigger> distanceTrigger_; | 
|---|
| 85 |  | 
|---|
| 86 | void destructionEffect(); | 
|---|
| 87 | void allowExplosion(); | 
|---|
| 88 | void explode(); | 
|---|
| 89 | }; | 
|---|
| 90 | } | 
|---|
| 91 |  | 
|---|
| 92 | #endif /* _MineProjectile_H__ */ | 
|---|