Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/weapons/projectiles/BasicProjectile.h @ 11105

Last change on this file since 11105 was 11099, checked in by muemart, 9 years ago

Fix loads of doxygen warnings and other documentation issues

  • Property svn:eol-style set to native
File size: 5.1 KB
Line 
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 *      simonmie
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file BasicProjectile.h
31    @brief Definition of the BasicProjectile class.
32*/
33
34#ifndef _BasicProjectile_H__
35#define _BasicProjectile_H__
36
37#include "weapons/WeaponsPrereqs.h"
38
39#include "worldentities/pawns/Pawn.h"
40
41#include "core/class/OrxonoxInterface.h"
42
43namespace orxonox
44{
45
46    /**
47    @brief
48        Baseclass of all projectiles. Defines the damage the projectile does.
49
50    @author
51        Simon Miescher
52    @ingroup WeaponsProjectiles
53    */
54    class _WeaponsExport BasicProjectile : public virtual OrxonoxInterface
55    {
56        public:
57            BasicProjectile();
58            virtual ~BasicProjectile();
59
60            /**
61            @brief Set the normal damage done by this projectile.
62                   Normal damage can be (partially) absorbed by shields.
63            @param damage The amount of damage. Must be non-negative.
64            */
65            inline void setDamage(float damage)
66                { if(damage >= 0.0f)  { this->damage_ = damage; return; } orxout(internal_warning) << "The input projectile damage must be non-negative. Ignoring..." << endl; }
67            /**
68            @brief Get the normal damage done by this projectile.
69                   Normal damage can be (partially) absorbed by shields.
70            @return Returns the amount of damage. Is non-negative.
71            */
72            inline float getDamage() const
73                { return this->damage_; }
74
75            /**
76            @brief Set the health-damage done by this projectile.
77                   Health-damage cannot be absorbed by shields.
78            @param healthdamage The amount of damage. Must be non-negative.
79            */
80            inline void setHealthDamage(float healthdamage)
81                { if(healthdamage >= 0.0f)  { this->healthdamage_ = healthdamage; return; } orxout(internal_warning) << "The input projectile health-damage must be non-negative. Ignoring..." << endl; }
82            /**
83            @brief Get the health-damage done by this projectile.
84                   Health-damage cannot be absorbed by shields.
85            @return healthdamage The amount of damage. Is non-negative.
86            */
87            inline float getHealthDamage() const
88                { return this->healthdamage_; }
89
90            /**
91            @brief Set the shield-damage done by this projectile.
92                   Shield-damage only reduces shield health.
93            @param shielddamage The amount of damage. Must be non-negative.
94            */
95            inline void setShieldDamage(float shielddamage)
96                { if(shielddamage >= 0.0f)  { this->shielddamage_ = shielddamage; return; } orxout(internal_warning) << "The input projectile shield-damage must be non-negative. Ignoring..." << endl; }
97            /**
98            @brief Get the shield-damage done by this projectile.
99            */
100            inline float getShieldDamage() const
101                { return this->shielddamage_; }
102
103            /**
104            @brief Set the entity that fired the projectile.
105            @param shooter A pointer to the Pawn that fired the projectile.
106            */
107            virtual void setShooter(Pawn* shooter)
108                { this->shooter_ = shooter; }
109            /**
110            @brief Get the entity that fired the projectile.
111            @return Returns a pointer to the Pawn that fired the projectile.
112            */
113            inline Pawn* getShooter(void)
114                { return this->shooter_; }
115
116            virtual void destroyObject(void);
117
118        protected:
119            bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs);
120            void destroyCheck(void);
121
122        private:
123            bool isObjectRelatedToShooter(WorldEntity* otherObject);
124
125            WeakPtr<Pawn> shooter_; //!< The entity that fired the projectile.
126
127            float damage_; //!< The amount of normal damage. Normal damage can be (partially) absorbed by shields.
128            float healthdamage_; //!< The amount of health-damage. Health-damage cannot be absorbed by shields.
129            float shielddamage_; //!< The amount of shield-damage. Shield-damage only reduces shield health.
130
131            bool bDestroy_; //!< Boolean, to check whether a projectile should be destroyed.
132    };
133}
134
135#endif /* _BasicProjectile_H__ */
Note: See TracBrowser for help on using the repository browser.