Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 11477 was 11108, checked in by fvultier, 9 years ago

A few modifications in the weapon system: WeaponModes may play a reload sound now. Fireing Sounds of WeaponModes may overlap now. New weapon: FlameGun, a flame thrower for close combat (e.g. for the FPS player)

  • Property svn:eol-style set to native
File size: 5.5 KB
RevLine 
[8492]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
[8855]29/**
30    @file BasicProjectile.h
31    @brief Definition of the BasicProjectile class.
32*/
33
[8492]34#ifndef _BasicProjectile_H__
35#define _BasicProjectile_H__
36
37#include "weapons/WeaponsPrereqs.h"
38
[8855]39#include "worldentities/pawns/Pawn.h"
40
[9667]41#include "core/class/OrxonoxInterface.h"
[8492]42
43namespace orxonox
44{
[8855]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    */
[9667]54    class _WeaponsExport BasicProjectile : public virtual OrxonoxInterface
[8492]55    {
56        public:
57            BasicProjectile();
58            virtual ~BasicProjectile();
59
[8855]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            */
[8492]65            inline void setDamage(float damage)
[8858]66                { if(damage >= 0.0f)  { this->damage_ = damage; return; } orxout(internal_warning) << "The input projectile damage must be non-negative. Ignoring..." << endl; }
[8855]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            */
[8492]72            inline float getDamage() const
73                { return this->damage_; }
74
[8855]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            */
[8492]80            inline void setHealthDamage(float healthdamage)
[8858]81                { if(healthdamage >= 0.0f)  { this->healthdamage_ = healthdamage; return; } orxout(internal_warning) << "The input projectile health-damage must be non-negative. Ignoring..." << endl; }
[8855]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            */
[8492]87            inline float getHealthDamage() const
88                { return this->healthdamage_; }
89
[8855]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            */
[8492]95            inline void setShieldDamage(float shielddamage)
[8858]96                { if(shielddamage >= 0.0f)  { this->shielddamage_ = shielddamage; return; } orxout(internal_warning) << "The input projectile shield-damage must be non-negative. Ignoring..." << endl; }
[8855]97            /**
98            @brief Get the shield-damage done by this projectile.
99            */
[8492]100            inline float getShieldDamage() const
101                { return this->shielddamage_; }
102
[8855]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_; }
[8492]115
[8855]116            virtual void destroyObject(void);
[8492]117
[8855]118        protected:
[10216]119            bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs);
[8855]120            void destroyCheck(void);
[11108]121            inline void setDestroyAfterCollision(bool destroyAfterCollision)
122                { destroyAfterCollision_ = destroyAfterCollision; }
123            inline bool getDestroyAfterCollision() const
124                { return destroyAfterCollision_; }
[8492]125
126        private:
[10293]127            bool isObjectRelatedToShooter(WorldEntity* otherObject);
128
[8855]129            WeakPtr<Pawn> shooter_; //!< The entity that fired the projectile.
[8492]130
[8855]131            float damage_; //!< The amount of normal damage. Normal damage can be (partially) absorbed by shields.
132            float healthdamage_; //!< The amount of health-damage. Health-damage cannot be absorbed by shields.
133            float shielddamage_; //!< The amount of shield-damage. Shield-damage only reduces shield health.
[8492]134
[8855]135            bool bDestroy_; //!< Boolean, to check whether a projectile should be destroyed.
[11108]136            bool destroyAfterCollision_; //!< Boolean, defines whether the projectile gets detroyed after a collision.
[8492]137    };
138}
139
140#endif /* _BasicProjectile_H__ */
Note: See TracBrowser for help on using the repository browser.