Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10035 was 9667, checked in by landauf, 11 years ago

merged core6 back to trunk

  • Property svn:eol-style set to native
File size: 5.2 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                   Shield-damage only reduces shield health.
100            @param shielddamage The amount of damage. Is non-negative.
101            */
102            inline float getShieldDamage() const
103                { return this->shielddamage_; }
104
105            /**
106            @brief Set the entity that fired the projectile.
107            @param shooter A pointer to the Pawn that fired the projectile.
108            */
109            virtual void setShooter(Pawn* shooter)
110                { this->shooter_ = shooter; }
111            /**
112            @brief Get the entity that fired the projectile.
113            @return Returns a pointer to the Pawn that fired the projectile.
114            */
115            inline Pawn* getShooter(void)
116                { return this->shooter_; }
117
118            virtual void destroyObject(void);
119
120        protected:
121            bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint);
122            void destroyCheck(void);
123
124        private:
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.