[Orxonox-commit 6178] r10836 - in code/branches/particleEffectsHS15: data/levels data/levels/includes data/levels/templates data/particle src/modules/weapons/munitions src/modules/weapons/projectiles src/modules/weapons/weaponmodes
holzerj at orxonox.net
holzerj at orxonox.net
Mon Nov 23 15:44:31 CET 2015
Author: holzerj
Date: 2015-11-23 15:44:31 +0100 (Mon, 23 Nov 2015)
New Revision: 10836
Added:
code/branches/particleEffectsHS15/data/particle/psygun.particle
code/branches/particleEffectsHS15/src/modules/weapons/munitions/MineMunition.cc
code/branches/particleEffectsHS15/src/modules/weapons/munitions/MineMunition.h
code/branches/particleEffectsHS15/src/modules/weapons/projectiles/MineProjectile.cc
code/branches/particleEffectsHS15/src/modules/weapons/projectiles/MineProjectile.h
code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes/MineGun.cc
code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes/MineGun.h
Modified:
code/branches/particleEffectsHS15/data/levels/emptyLevel.oxw
code/branches/particleEffectsHS15/data/levels/includes/weaponSettingsAssff2.oxi
code/branches/particleEffectsHS15/data/levels/includes/weaponSettingsEscort.oxi
code/branches/particleEffectsHS15/data/levels/templates/spaceshipEscort.oxt
code/branches/particleEffectsHS15/data/particle/ice.particle
code/branches/particleEffectsHS15/data/particle/rocketfire.particle
code/branches/particleEffectsHS15/src/modules/weapons/munitions/CMakeLists.txt
code/branches/particleEffectsHS15/src/modules/weapons/projectiles/CMakeLists.txt
code/branches/particleEffectsHS15/src/modules/weapons/projectiles/IceGunProjectile.cc
code/branches/particleEffectsHS15/src/modules/weapons/projectiles/IceGunProjectile.h
code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes/CMakeLists.txt
Log:
Added Mine, ice particle, rocketfire, psygun
Modified: code/branches/particleEffectsHS15/data/levels/emptyLevel.oxw
===================================================================
--- code/branches/particleEffectsHS15/data/levels/emptyLevel.oxw 2015-11-23 14:32:48 UTC (rev 10835)
+++ code/branches/particleEffectsHS15/data/levels/emptyLevel.oxw 2015-11-23 14:44:31 UTC (rev 10836)
@@ -33,16 +33,33 @@
<Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
<SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
- <ParticleEmitter
- source="Orxonox/engine"
- position="0,0,0"
- lifetime=1.0 loop=1 startdelay=2.0
- />
- <ParticleEmitter
- source="Orxonox/ice"
- position="0,0,100"
- lifetime=2.0 loop=1 startdelay=3.0
- />
+ <Pawn team=1 health=30 position="0,100,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box RVName = "Box 4" >
+ <events>
+ <visibility>
+ <EventListener event="flying4" />
+ </visibility>
+ </events>
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+ </collisionShapes>
+ </Pawn>
+
+ <Pawn team=1 health=30 position="0,200,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box RVName = "Box 3">
+ <events>
+ <visibility>
+ <EventListener event="flying4" />
+ </visibility>
+ </events>
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+ </collisionShapes>
+ </Pawn>
</Scene>
</Level>
Modified: code/branches/particleEffectsHS15/data/levels/includes/weaponSettingsAssff2.oxi
===================================================================
--- code/branches/particleEffectsHS15/data/levels/includes/weaponSettingsAssff2.oxi 2015-11-23 14:32:48 UTC (rev 10835)
+++ code/branches/particleEffectsHS15/data/levels/includes/weaponSettingsAssff2.oxi 2015-11-23 14:44:31 UTC (rev 10836)
@@ -1,4 +1,4 @@
- <weaponslots>
+t <weaponslots>
<WeaponSlot position="-15.0,-1.5,0" />
<WeaponSlot position=" 15.0,-1.5,0" />
<WeaponSlot position=" 0, 0,0" />
Modified: code/branches/particleEffectsHS15/data/levels/includes/weaponSettingsEscort.oxi
===================================================================
--- code/branches/particleEffectsHS15/data/levels/includes/weaponSettingsEscort.oxi 2015-11-23 14:32:48 UTC (rev 10835)
+++ code/branches/particleEffectsHS15/data/levels/includes/weaponSettingsEscort.oxi 2015-11-23 14:44:31 UTC (rev 10836)
@@ -13,12 +13,10 @@
<DefaultWeaponmodeLink firemode=1 weaponmode=1 />
</links>
<Weapon>
- <HsW01 mode=0 munitionpershot=0 delay=0.125 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" projectileMesh="LaserBeam2.mesh" />
- <!--HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6, 1.3,-2" projectileMesh="LaserBeam2.mesh" /-->
+ <MineGun mode=0 munitionpershot=0 delay=0.125 damage=9.3 muzzleoffset=" 0.1, 1.4,-3" />
</Weapon>
<Weapon>
- <HsW01 mode=0 munitionpershot=0 delay=0 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" projectileMesh="LaserBeam2.mesh" />
- <!--HsW01 mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-0.1, 1.6, -2.0" projectileMesh="LaserBeam2.mesh" /-->
+ <SplitGun mode=0 munitionpershot=0 delay=0.125 damage=9.3 muzzleoffset=" 0.1, 1.4,-3" />
</Weapon>
</WeaponPack>
<WeaponPack>
Modified: code/branches/particleEffectsHS15/data/levels/templates/spaceshipEscort.oxt
===================================================================
--- code/branches/particleEffectsHS15/data/levels/templates/spaceshipEscort.oxt 2015-11-23 14:32:48 UTC (rev 10835)
+++ code/branches/particleEffectsHS15/data/levels/templates/spaceshipEscort.oxt 2015-11-23 14:44:31 UTC (rev 10836)
@@ -91,27 +91,29 @@
>
<EffectContainer condition="idle">
<WorldSound mainstate="activity" source="sounds/Engine_idle.ogg" looping=1 active=false/>
+ />
+
+ <Backlight mainstate=activity active=false scale=0.33 name=bltest position=" 12, -2, 14" colour="0.2, 0.5, 0.65, 1.0" width=150 length=15 lifetime=2 elements=1 trailmaterial="Trail/backlighttrail" turnontime=2 turnofftime=1 material="Flares/ThrusterFlare1" />
+
+ <Backlight mainstate=activity active=false scale=0.33 name=bltest position="-12, -2, 14" colour="0.2, 0.5, 0.65, 1.0" width=15 length=15 lifetime=2 elements=1 trailmaterial="Trail/backlighttrail" turnontime=2 turnofftime=1 material="Flares/ThrusterFlare1" />
+
</EffectContainer>
<EffectContainer condition="not idle">
+ <FadingBillboard mainstate=activity active=false scale=0.09 position="12, -2, 13" colour="0.2, 1.0, 0.65, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+ <FadingBillboard mainstate=activity active=false scale=0.09 position="-12, -2, 13" colour="0.2, 1.0, 0.65, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
</EffectContainer>
<EffectContainer condition="normal or brake">
</EffectContainer>
+
<EffectContainer condition="normal or boost">
- <ParticleEmitter
- source="Orxonox/engine"
- position="-12,-1.75,13"
- lifetime=5.0 loop=1 startdelay=0.0
- scale=0.3
- />
- <ParticleEmitter
- source="Orxonox/engine"
- position="12,-1.75,13"
- lifetime=5.0 loop=1 startdelay=0.0
- scale=0.3
- />
-
+
+
+ <Backlight mainstate=activity active=false scale=0.33 name=bltest position=" 12, -2, 14" colour="0.2, 1.0, 0.65, 1.0" width=5 length=1500 lifetime=2 elements=1 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+
+ <Backlight mainstate=activity active=false scale=0.33 name=bltest position="-12, -2, 14" colour="0.2, 1.0, 0.65, 1.0" width=15 length=1500 lifetime=2 elements=1 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
</EffectContainer>
+
<EffectContainer condition="boost">
<Backlight mainstate=activity active=false scale=0.33 name=bltest position=" 12, 0, 10" colour="0.6, 0.8, 0.75, 0.7" width=25 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
<Backlight mainstate=activity active=false scale=0.33 name=bltest position="-12, 0, 10" colour="0.6, 0.8, 0.75, 0.7" width=25 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
Modified: code/branches/particleEffectsHS15/data/particle/ice.particle
===================================================================
--- code/branches/particleEffectsHS15/data/particle/ice.particle 2015-11-23 14:32:48 UTC (rev 10835)
+++ code/branches/particleEffectsHS15/data/particle/ice.particle 2015-11-23 14:44:31 UTC (rev 10836)
@@ -1,8 +1,8 @@
particle_system Orxonox/ice
{
- material PE/Hidden.001
- particle_width 66.6699981689453
- particle_height 38.0999984741211
+ material PE/iceCrystal
+ particle_width 5
+ particle_height 5
quota 7000
cull_each false
sorted false
@@ -17,23 +17,23 @@
emitter Box
{
- position 0.0 500.0 0.0
- direction 0.0 0.0 1.0
- angle 0
- width 200
- height 200
- depth 200
- emission_rate 20
+ position 0.0 0.0 0.0
+ direction 1.0 1.0 1.0
+ angle 45
+ width 20
+ height 20
+ depth 20
+ emission_rate 200
velocity_min 1
velocity_max 1
- time_to_live_min 10
- time_to_live_max 20
+ time_to_live_min 3
+ time_to_live_max 6
duration_min 0
duration_max 0
repeat_delay_min 0
repeat_delay_max 0
colour_range_start 1 1 1 1
- colour_range_end 0.835294 0.956863 1 1
+ colour_range_end 0.9 1 1 1
}
affector LinearForce
Added: code/branches/particleEffectsHS15/data/particle/psygun.particle
===================================================================
--- code/branches/particleEffectsHS15/data/particle/psygun.particle (rev 0)
+++ code/branches/particleEffectsHS15/data/particle/psygun.particle 2015-11-23 14:44:31 UTC (rev 10836)
@@ -0,0 +1,62 @@
+particle_system Orxonox/psygun
+{
+ material PE/glowEffect
+ particle_width 200.0
+ particle_height 200.0
+ quota 300
+ cull_each false
+ sorted false
+ local_space false
+ iteration_interval 0.0
+ nonvisible_update_timeout 0.0
+ billboard_type point
+ billboard_origin top_right
+ billboard_rotation_type vertex
+ point_rendering false
+ accurate_facing true
+
+ emitter Point
+ {
+ position 0.0 0.0 0.0
+ direction 0.0 1.0 0.0
+ angle 154.8
+ emission_rate 400
+ velocity_min 100
+ velocity_max 300
+ time_to_live_min 0
+ time_to_live_max 3.38
+ duration_min 1
+ duration_max 1
+ repeat_delay_min 0.11
+ repeat_delay_max 2.81
+ colour_range_start 0.666667 0 0.498039 1
+ colour_range_end 1 0 0.498039 1
+ }
+
+ affector LinearForce
+ {
+ force_vector 0.0 12.32 0.0
+ force_application add
+ }
+
+ affector Rotator
+ {
+ rotation_speed_range_start 100
+ rotation_speed_range_end 500
+ rotation_range_start 0
+ rotation_range_end 180
+ }
+
+ affector Scaler
+ {
+ rate -98.82
+ }
+
+ affector ColourFader
+ {
+ red -0.93
+ green -1
+ blue 1
+ alpha -1
+ }
+}
Modified: code/branches/particleEffectsHS15/data/particle/rocketfire.particle
===================================================================
--- code/branches/particleEffectsHS15/data/particle/rocketfire.particle 2015-11-23 14:32:48 UTC (rev 10835)
+++ code/branches/particleEffectsHS15/data/particle/rocketfire.particle 2015-11-23 14:44:31 UTC (rev 10836)
@@ -1,12 +1,12 @@
particle_system Orxonox/rocketfire
{
- material PE/Special.001
- particle_width 6.67000007629395
- particle_height 3.80999994277954
- quota 300
- cull_each false
- sorted false
- local_space false
+ material PE/glowEffect
+ particle_width 2
+ particle_height 2
+ quota 10000
+ cull_each true
+ sorted true
+ local_space true
iteration_interval 0.0
nonvisible_update_timeout 0.0
billboard_type point
@@ -17,7 +17,7 @@
emitter Ellipsoid
{
- position 0.0 0.0 3.0
+ position 0.05 0.0 2.0
direction 0.0 0.0 1.0
angle 0
width 0
@@ -25,9 +25,9 @@
depth 0
emission_rate 1200
velocity_min 10
- velocity_max 48
+ velocity_max 20
time_to_live_min 0.1
- time_to_live_max 0.19
+ time_to_live_max 0.1
duration_min 0
duration_max 0
repeat_delay_min 0
@@ -35,6 +35,26 @@
colour_range_start 1 0.333333 0 1
colour_range_end 1 0 0 1
}
+ emitter Ellipsoid
+ {
+ position 0.05 0.0 2.0
+ direction 0.0 0.0 1.0
+ angle 0
+ width 0
+ height 0
+ depth 0
+ emission_rate 100
+ velocity_min 5
+ velocity_max 10
+ time_to_live_min 0.1
+ time_to_live_max 0.1
+ duration_min 0
+ duration_max 0
+ repeat_delay_min 0
+ repeat_delay_max 0
+ colour_range_start 0.2 0.5 0.65
+ colour_range_end 0.25 0.55 0.7
+ }
affector Scaler
{
Modified: code/branches/particleEffectsHS15/src/modules/weapons/munitions/CMakeLists.txt
===================================================================
--- code/branches/particleEffectsHS15/src/modules/weapons/munitions/CMakeLists.txt 2015-11-23 14:32:48 UTC (rev 10835)
+++ code/branches/particleEffectsHS15/src/modules/weapons/munitions/CMakeLists.txt 2015-11-23 14:44:31 UTC (rev 10836)
@@ -6,4 +6,5 @@
GravityBombMunition.cc
IceMunition.cc
SplitMunition.cc
+ MineMunition.cc
)
Added: code/branches/particleEffectsHS15/src/modules/weapons/munitions/MineMunition.cc
===================================================================
--- code/branches/particleEffectsHS15/src/modules/weapons/munitions/MineMunition.cc (rev 0)
+++ code/branches/particleEffectsHS15/src/modules/weapons/munitions/MineMunition.cc 2015-11-23 14:44:31 UTC (rev 10836)
@@ -0,0 +1,55 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file MineMunition.h
+ @brief Implementation of the MineMunition class.
+*/
+
+#include "MineMunition.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ RegisterClass(MineMunition);
+
+ MineMunition::MineMunition(Context* context) : Munition(context)
+ {
+ RegisterObject(MineMunition);
+
+ this->maxMunitionPerMagazine_ = 1;
+ this->maxMagazines_ = 100;
+ this->magazines_ = 25;
+
+ this->bUseSeparateMagazines_ = false;
+ this->bStackMunition_ = true;
+
+ this->bAllowMunitionRefilling_ = true;
+ this->bAllowMultiMunitionRemovementUnderflow_ = false;
+ }
+}
Added: code/branches/particleEffectsHS15/src/modules/weapons/munitions/MineMunition.h
===================================================================
--- code/branches/particleEffectsHS15/src/modules/weapons/munitions/MineMunition.h (rev 0)
+++ code/branches/particleEffectsHS15/src/modules/weapons/munitions/MineMunition.h 2015-11-23 14:44:31 UTC (rev 10836)
@@ -0,0 +1,58 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file MineMunition.h
+ @brief Definition of the MineMunition class.
+*/
+
+#ifndef _MineMunition_H__
+#define _MineMunition_H__
+
+#include "weapons/WeaponsPrereqs.h"
+#include "weaponsystem/Munition.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ MineMunition.
+ @author
+ Fabien Vultier
+ @ingroup WeaponsMunitions
+ */
+ class _WeaponsExport MineMunition : public Munition
+ {
+ public:
+ MineMunition(Context* context);
+ virtual ~MineMunition() {}
+ };
+}
+
+#endif /* _MineMunition_H__ */
Modified: code/branches/particleEffectsHS15/src/modules/weapons/projectiles/CMakeLists.txt
===================================================================
--- code/branches/particleEffectsHS15/src/modules/weapons/projectiles/CMakeLists.txt 2015-11-23 14:32:48 UTC (rev 10835)
+++ code/branches/particleEffectsHS15/src/modules/weapons/projectiles/CMakeLists.txt 2015-11-23 14:44:31 UTC (rev 10836)
@@ -11,4 +11,5 @@
SimpleRocket.cc
GravityBomb.cc
GravityBombField.cc
+ MineProjectile.cc
)
Modified: code/branches/particleEffectsHS15/src/modules/weapons/projectiles/IceGunProjectile.cc
===================================================================
--- code/branches/particleEffectsHS15/src/modules/weapons/projectiles/IceGunProjectile.cc 2015-11-23 14:32:48 UTC (rev 10835)
+++ code/branches/particleEffectsHS15/src/modules/weapons/projectiles/IceGunProjectile.cc 2015-11-23 14:44:31 UTC (rev 10836)
@@ -33,8 +33,15 @@
#include "IceGunProjectile.h"
+#include <OgreSceneManager.h>
+#include <OgreSceneNode.h>
+
#include "core/CoreIncludes.h"
#include "graphics/Model.h"
+#include "graphics/ParticleSpawner.h"
+#include "Scene.h"
+#include "core/command/Executor.h"
+#include "tools/ParticleInterface.h"
namespace orxonox
{
@@ -54,8 +61,31 @@
model->setScale(15.0);
this->attach(model);
model->setPosition(Vector3(0,0,0));
+
+ // Add effect.
+ emitter_ = new ParticleEmitter(this->getContext());
+ this->attach(emitter_);
+ emitter_->setOrientation(this->getOrientation());
+ emitter_->setSource("Orxonox/ice");
}
+ IceGunProjectile::~IceGunProjectile()
+ {
+ if (this->isInitialized())
+ {
+ const Vector3& pos = emitter_->getWorldPosition();
+ const Quaternion& rot = emitter_->getWorldOrientation();
+ this->detach(emitter_);
+ emitter_->setPosition(pos);
+ emitter_->setOrientation(rot);
+ emitter_->getParticleInterface()->setEnabled(false);
+ this->getScene()->getRootSceneNode()->addChild(const_cast<Ogre::SceneNode*>(emitter_->getNode()));
+
+ const ExecutorPtr& executor = createExecutor(createFunctor(&ParticleEmitter::destroy, emitter_));
+ new Timer(15, false, executor, true);
+ }
+ }
+
/**
@brief
Sets the freeze time variable to the passed value.
Modified: code/branches/particleEffectsHS15/src/modules/weapons/projectiles/IceGunProjectile.h
===================================================================
--- code/branches/particleEffectsHS15/src/modules/weapons/projectiles/IceGunProjectile.h 2015-11-23 14:32:48 UTC (rev 10835)
+++ code/branches/particleEffectsHS15/src/modules/weapons/projectiles/IceGunProjectile.h 2015-11-23 14:44:31 UTC (rev 10836)
@@ -55,14 +55,15 @@
{
public:
IceGunProjectile(Context* context);
- virtual ~IceGunProjectile() {}
+ virtual ~IceGunProjectile();
virtual void setFreezeTime(float freezeTime);
virtual void setFreezeFactor(float freezeFactor);
protected:
virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
- private:
+ private:
+ ParticleEmitter* emitter_;
float freezeTime_; //The duration of the freezing effect on a target
float freezeFactor_; //The strength of the freezing effect
};
Added: code/branches/particleEffectsHS15/src/modules/weapons/projectiles/MineProjectile.cc
===================================================================
--- code/branches/particleEffectsHS15/src/modules/weapons/projectiles/MineProjectile.cc (rev 0)
+++ code/branches/particleEffectsHS15/src/modules/weapons/projectiles/MineProjectile.cc 2015-11-23 14:44:31 UTC (rev 10836)
@@ -0,0 +1,104 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file MineProjectile.h
+ @brief Implementation of the MineProjectile class.
+*/
+
+#include "MineProjectile.h"
+
+#include "core/CoreIncludes.h"
+#include "core/command/Executor.h"
+#include "util/Convert.h"
+#include "util/Math.h"
+
+#include "core/CoreIncludes.h"
+#include "graphics/Model.h"
+#include "graphics/ParticleSpawner.h"
+#include "Scene.h"
+#include "core/command/Executor.h"
+#include "tools/ParticleInterface.h"
+
+namespace orxonox
+{
+ RegisterClass(MineProjectile);
+
+ MineProjectile::MineProjectile(Context* context) : Projectile(context)
+ {
+ RegisterObject(MineProjectile);
+
+ this->lifeTime_ = 1.0f;
+
+ Model* model = new Model(this->getContext());
+ model->setMeshSource("sphere.mesh");
+ model->setScale(15.0);
+ this->attach(model);
+ model->setPosition(Vector3(0,0,0));
+ }
+
+
+ /**
+ @brief
+ This function starts a timer that will cause the projectile to Mine after a time defined by the argument @param LifeTime.
+ */
+ void MineProjectile::setLifeTime(float lifeTime)
+ {
+ orxout() << lifeTime << endl;
+
+ if (lifeTime >= 0)
+ {
+ this->lifeTime_ = lifeTime;
+ this->explodeTimer.setTimer(this->lifeTime_, false, createExecutor(createFunctor(&MineProjectile::Explode, this)));
+ }
+ else
+ {
+ this->lifeTime_ = 0;
+ }
+ }
+
+
+ /**
+ @brief
+ This is the setter function for the damageReduction_ variable. The value of the variable is bounded between 0 and 1.
+ */
+
+
+ /**
+ @brief
+ If this function is called the projectile Mines up into many child projectiles. The original projectiles does not get destroyed but it will never Mine up again.
+ */
+ void MineProjectile::Explode()
+ {
+ orxout() << "Explode" << endl;
+
+ this->destroyLater();
+
+
+ }
+}
Added: code/branches/particleEffectsHS15/src/modules/weapons/projectiles/MineProjectile.h
===================================================================
--- code/branches/particleEffectsHS15/src/modules/weapons/projectiles/MineProjectile.h (rev 0)
+++ code/branches/particleEffectsHS15/src/modules/weapons/projectiles/MineProjectile.h 2015-11-23 14:44:31 UTC (rev 10836)
@@ -0,0 +1,71 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file IceGunProjectile.h
+ @brief Definition of the MineProjectile class.
+*/
+
+#ifndef _MineProjectile_H__
+#define _MineProjectile_H__
+
+#include "weapons/WeaponsPrereqs.h"
+
+#include <string>
+#include "tools/Timer.h"
+#include "Projectile.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ The MineProjectile is a projectile that may Mine up into many child projectiles.
+ @author
+ Fabien Vultier
+ @ingroup WeaponsProjectiles
+ */
+ class _WeaponsExport MineProjectile : public Projectile
+ {
+ public:
+ MineProjectile(Context* context);
+ virtual ~MineProjectile() {}
+
+ virtual void setLifeTime(float LifeTime);
+
+
+
+ private:
+ float lifeTime_;
+ Timer explodeTimer;
+
+ virtual void Explode();
+ };
+}
+
+#endif /* _MineProjectile_H__ */
Modified: code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes/CMakeLists.txt
===================================================================
--- code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes/CMakeLists.txt 2015-11-23 14:32:48 UTC (rev 10835)
+++ code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes/CMakeLists.txt 2015-11-23 14:44:31 UTC (rev 10836)
@@ -10,4 +10,5 @@
RocketFireOld.cc
SimpleRocketFire.cc
GravityBombFire.cc
+ MineGun.cc
)
Added: code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes/MineGun.cc
===================================================================
--- code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes/MineGun.cc (rev 0)
+++ code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes/MineGun.cc 2015-11-23 14:44:31 UTC (rev 10836)
@@ -0,0 +1,102 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file MineGun.cc
+ @brief Implementation of the MineGun class.
+*/
+
+#include "MineGun.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "weaponsystem/Weapon.h"
+#include "weaponsystem/WeaponPack.h"
+#include "weaponsystem/WeaponSystem.h"
+#include "worldentities/pawns/Pawn.h"
+
+#include "weapons/projectiles/MineProjectile.h"
+
+namespace orxonox
+{
+ RegisterClass(MineGun);
+
+ MineGun::MineGun(Context* context) : WeaponMode(context)
+ {
+ RegisterObject(MineGun);
+
+ this->reloadTime_ = 1.0f;
+ this->damage_ = 0.0f;
+ this->speed_ = 0.0f;
+ this->lifeTime_ = 7500.0f;
+
+ this->setMunitionName("MineMunition");
+ this->setDefaultSound("sounds/Weapon_LightningGun.ogg");
+ }
+
+ MineGun::~MineGun()
+ {
+ }
+
+ /**
+ @brief
+ XMLPort for the MineGun. You can define how often the projectiles Mine, how many childs should be created per Mine, the spread and the time between two Mines.
+ */
+ void MineGun::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(MineGun, XMLPort, xmlelement, mode);
+ XMLPortParam(MineGun, "Lifetime", setLifeTime, getLifeTime, xmlelement, mode);
+ }
+
+ /**
+ @brief
+ Fires the weapon. Creates a projectile and fires it.
+ */
+ void MineGun::fire()
+ {
+ MineProjectile* projectile = new MineProjectile(this->getContext());
+ //projectile->setMaterial("Flares/energyflare");
+
+ this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
+ projectile->setOrientation(this->getMuzzleOrientation());
+ projectile->setPosition(this->getMuzzlePosition());
+ projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
+
+ // Pass important information to the projectile: Number of Mines, Number of childs, Mine time, spread and the damage reduction
+ /*projectile->setNumberOfMines(getNumberOfMines());
+ projectile->setNumberOfChilds(getNumberOfChilds());*/
+ projectile->setLifeTime(getLifeTime());
+ /*projectile->setSpread(getSpread());
+ projectile->setDamageReduction(getDamageReduction());*/
+
+ projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ projectile->setDamage(this->getDamage());
+ projectile->setShieldDamage(this->getShieldDamage());
+ projectile->setHealthDamage(this->getHealthDamage());
+ }
+}
Added: code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes/MineGun.h
===================================================================
--- code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes/MineGun.h (rev 0)
+++ code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes/MineGun.h 2015-11-23 14:44:31 UTC (rev 10836)
@@ -0,0 +1,70 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file MineGun.h
+ @brief Definition of the MineGun class.
+*/
+
+#ifndef _MineGun_H__
+#define _MineGun_H__
+
+#include "weapons/WeaponsPrereqs.h"
+#include "weaponsystem/WeaponMode.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ A Mine that explodes when a ship is too close
+ @author
+ Fabien Vultier
+ @ingroup WeaponsWeaponModes
+ */
+ class _WeaponsExport MineGun : public WeaponMode
+ {
+ public:
+ MineGun(Context* context);
+ virtual ~MineGun();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void fire();
+ inline void setLifeTime(float lifeTime)
+ { this->lifeTime_ = lifeTime; }
+ inline float getLifeTime() const
+ { return this->lifeTime_; }
+
+ private:
+ float speed_; //The speed of the fired projectile.
+ float lifeTime_;
+
+ };
+}
+
+#endif /* _MineGun_H__ */
More information about the Orxonox-commit
mailing list