[Orxonox-commit 395] r2983 - in branches/weapons/src/orxonox/objects/weaponsystem: . weaponmodes
Hagen at orxonox.net
Hagen at orxonox.net
Mon May 18 16:29:40 CEST 2009
Author: Hagen
Date: 2009-05-18 16:29:40 +0200 (Mon, 18 May 2009)
New Revision: 2983
Added:
branches/weapons/src/orxonox/objects/weaponsystem/CMakeLists.txt~
branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.cc
branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.h
branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.h~
branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt~
branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc
branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc~
branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h
branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h~
branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc~
branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h~
Modified:
branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt
branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc
Log:
MuzzleFlash finally there, EnergyDrink weapon
Added: branches/weapons/src/orxonox/objects/weaponsystem/CMakeLists.txt~
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/CMakeLists.txt~ (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/CMakeLists.txt~ 2009-05-18 14:29:40 UTC (rev 2983)
@@ -0,0 +1,14 @@
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+ Munition.cc
+ Weapon.cc
+ WeaponMode.cc
+ WeaponPack.cc
+ WeaponSet.cc
+ WeaponSlot.cc
+ WeaponSystem.cc
+ DefaultWeaponmodeLink.cc
+)
+
+ADD_SUBDIRECTORY(munitions)
+ADD_SUBDIRECTORY(projectiles)
+ADD_SUBDIRECTORY(weaponmodes)
Added: branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.cc (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.cc 2009-05-18 14:29:40 UTC (rev 2983)
@@ -0,0 +1,56 @@
+/*
+ * 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:
+ * Hagen Seifert
+ * Co-authors:
+ * Ich
+ * Dini Mueter
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "MuzzleFlash.h"
+
+#include "core/GameMode.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+ CreateFactory(MuzzleFlash);
+
+ MuzzleFlash::MuzzleFlash(BaseObject* creator) : Billboard(creator)
+ {
+ RegisterObject(MuzzleFlash);
+ this->setScale(0.1);
+
+ this->delayTimer_.setTimer(0.1f, false, this, createExecutor(createFunctor(&MuzzleFlash::destroy)));
+
+ }
+
+ void MuzzleFlash::destroy()
+ {
+ delete this;
+ }
+
+}
Added: branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.h (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.h 2009-05-18 14:29:40 UTC (rev 2983)
@@ -0,0 +1,54 @@
+/*
+ * 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:
+ * Hagen Seifert
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _MuzzleFlash_H__
+#define _MuzzleFlash_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/worldentities/Billboard.h"
+#include "tools/Timer.h"
+
+
+namespace orxonox
+{
+ class _OrxonoxExport MuzzleFlash : public Billboard
+ {
+ public:
+ MuzzleFlash(BaseObject* creator);
+ virtual ~MuzzleFlash() {}
+
+
+
+ private:
+ void destroy();
+ Timer<MuzzleFlash> delayTimer_;
+
+ };
+}
+
+#endif /* _MuzzleFlash_H__ */
Added: branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.h~
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.h~ (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.h~ 2009-05-18 14:29:40 UTC (rev 2983)
@@ -0,0 +1,54 @@
+/*
+ * 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:
+ * Hagen Seifert
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _MuzzleFlash_H__
+#define _MuzzleFlash_H__
+
+#include "OrxonoxPrereqs.h"
+#include "worldentities/Billboard.h"
+#include "tools/Timer.h"
+
+
+namespace orxonox
+{
+ class _OrxonoxExport MuzzleFlash : public Billboard
+ {
+ public:
+ MuzzleFlash(BaseObject* creator);
+ virtual ~MuzzleFlash() {}
+
+
+
+ private:
+ void destroy();
+ Timer<MuzzleFlash> delayTimer_;
+
+ };
+}
+
+#endif /* _MuzzleFlash_H__ */
Modified: branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt 2009-05-18 13:38:22 UTC (rev 2982)
+++ branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt 2009-05-18 14:29:40 UTC (rev 2983)
@@ -1,9 +1,7 @@
ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+ EnergyDrink.cc
FusionFire.cc
LaserFire.cc
-<<<<<<< .mine
HsW01.cc
-=======
LightningGun.cc
->>>>>>> .r2978
)
Added: branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt~
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt~ (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt~ 2009-05-18 14:29:40 UTC (rev 2983)
@@ -0,0 +1,6 @@
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+ FusionFire.cc
+ LaserFire.cc
+ HsW01.cc
+ LightningGun.cc
+)
Added: branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc 2009-05-18 14:29:40 UTC (rev 2983)
@@ -0,0 +1,121 @@
+/*
+ * 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:
+ * Hagen Seifert
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "EnergyDrink.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/weaponsystem/projectiles/ParticleProjectile.h"
+#include "objects/worldentities/Model.h"
+#include "objects/weaponsystem/MuzzleFlash.h"
+
+#include "objects/weaponsystem/Weapon.h"
+#include "objects/weaponsystem/WeaponPack.h"
+#include "objects/weaponsystem/WeaponSystem.h"
+
+namespace orxonox
+{
+ CreateFactory(EnergyDrink);
+
+ EnergyDrink::EnergyDrink(BaseObject* creator) : WeaponMode(creator)
+ {
+ RegisterObject(EnergyDrink);
+
+ this->reloadTime_ = 0.25;
+ this->damage_ = 15;
+ this->speed_ = 2500;
+ this->delay_ = 0;
+ this->setMunitionName("EnergyDrink");
+
+ this->delayTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&EnergyDrink::shot)));
+ this->delayTimer_.stopTimer();
+ }
+
+ void EnergyDrink::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(EnergyDrink, XMLPort, xmlelement, mode);
+
+ XMLPortParam(EnergyDrink, "delay", setDelay, getDelay, xmlelement, mode);
+ XMLPortParam(EnergyDrink, "material", setMaterial, getMaterial, xmlelement, mode);
+
+ }
+
+ void EnergyDrink::setMaterial(const std::string& material)
+ {
+ this->material_ = material;
+ }
+
+ std::string& EnergyDrink::getMaterial()
+ {
+ return this->material_;
+ }
+
+ void EnergyDrink::setDelay(float d)
+ {
+ this->delay_ = d;
+ this->delayTimer_.setInterval(this->delay_);
+ }
+
+ float EnergyDrink::getDelay() const
+ {
+ return this->delay_;
+ }
+
+ void EnergyDrink::fire()
+ {
+ this->delayTimer_.startTimer();
+ }
+
+ void EnergyDrink::muendungsfeuer()
+ {
+ MuzzleFlash *muzzleFlash = new MuzzleFlash(this);
+ this->getWeapon()->attach(muzzleFlash);
+ muzzleFlash->setPosition(this->getMuzzleOffset());
+ muzzleFlash->setMaterial(this->material_);
+ }
+
+ void EnergyDrink::shot()
+ {
+ Projectile* projectile = new Projectile(this);
+ Model* model = new Model(projectile);
+ model->setMeshSource("can.mesh");
+ model->setCastShadows(false);
+ projectile->attach(model);
+ model->setScale(5);
+
+ projectile->setOrientation(this->getMuzzleOrientation());
+ projectile->setPosition(this->getMuzzlePosition());
+ projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
+
+ projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ projectile->setDamage(this->getDamage());
+
+ EnergyDrink::muendungsfeuer();
+ }
+}
Added: branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc~
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc~ (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc~ 2009-05-18 14:29:40 UTC (rev 2983)
@@ -0,0 +1,121 @@
+/*
+ * 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:
+ * Hagen Seifert
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "EnergyDrink.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/weaponsystem/projectiles/ParticleProjectile.h"
+#include "objects/worldentities/Model.h"
+#include "objects/worldentities/MuzzleFlash.h"
+
+#include "objects/weaponsystem/Weapon.h"
+#include "objects/weaponsystem/WeaponPack.h"
+#include "objects/weaponsystem/WeaponSystem.h"
+
+namespace orxonox
+{
+ CreateFactory(EnergyDrink);
+
+ EnergyDrink::EnergyDrink(BaseObject* creator) : WeaponMode(creator)
+ {
+ RegisterObject(EnergyDrink);
+
+ this->reloadTime_ = 0.25;
+ this->damage_ = 15;
+ this->speed_ = 2500;
+ this->delay_ = 0;
+ this->setMunitionName("EnergyDrink");
+
+ this->delayTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&EnergyDrink::shot)));
+ this->delayTimer_.stopTimer();
+ }
+
+ void EnergyDrink::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(EnergyDrink, XMLPort, xmlelement, mode);
+
+ XMLPortParam(EnergyDrink, "delay", setDelay, getDelay, xmlelement, mode);
+ XMLPortParam(EnergyDrink, "material", setMaterial, getMaterial, xmlelement, mode);
+
+ }
+
+ void EnergyDrink::setMaterial(const std::string& material)
+ {
+ this->material_ = material;
+ }
+
+ std::string& EnergyDrink::getMaterial()
+ {
+ return this->material_;
+ }
+
+ void EnergyDrink::setDelay(float d)
+ {
+ this->delay_ = d;
+ this->delayTimer_.setInterval(this->delay_);
+ }
+
+ float EnergyDrink::getDelay() const
+ {
+ return this->delay_;
+ }
+
+ void EnergyDrink::fire()
+ {
+ this->delayTimer_.startTimer();
+ }
+
+ void EnergyDrink::muendungsfeuer()
+ {
+ MuzzleFlash *muzzleFlash = new MuzzleFlash(this);
+ this->getWeapon()->attach(muzzleFlash);
+ muzzleFlash->setPosition(this->getMuzzleOffset());
+ muzzleFlash->setMaterial(this->material_);
+ }
+
+ void EnergyDrink::shot()
+ {
+ Projectile* projectile = new Projectile(this);
+ Model* model = new Model(projectile);
+ model->setMeshSource("can.mesh");
+ model->setCastShadows(false);
+ projectile->attach(model);
+ model->setScale(5);
+
+ projectile->setOrientation(this->getMuzzleOrientation());
+ projectile->setPosition(this->getMuzzlePosition());
+ projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
+
+ projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ projectile->setDamage(this->getDamage());
+
+ EnergyDrink::muendungsfeuer();
+ }
+}
Added: branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h 2009-05-18 14:29:40 UTC (rev 2983)
@@ -0,0 +1,62 @@
+/*
+ * 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:
+ * Hagen Seifert
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _EnergyDrink_H__
+#define _EnergyDrink_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/weaponsystem/WeaponMode.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport EnergyDrink : public WeaponMode
+ {
+ public:
+ EnergyDrink(BaseObject* creator);
+ virtual ~EnergyDrink() {}
+
+ virtual void fire();
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ private:
+ void setMaterial(const std::string& material);
+ std::string& getMaterial();
+ void setDelay(float d);
+ float getDelay() const;
+ void shot();
+ void muendungsfeuer();
+
+ std::string material_;
+ float speed_;
+ float delay_;
+ Timer<EnergyDrink> delayTimer_;
+ };
+}
+
+#endif /* _EnergyDrink_H__ */
Added: branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h~
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h~ (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h~ 2009-05-18 14:29:40 UTC (rev 2983)
@@ -0,0 +1,62 @@
+/*
+ * 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:
+ * Hagen Seifert
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _HsW01_H__
+#define _HsW01_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/weaponsystem/WeaponMode.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport HsW01 : public WeaponMode
+ {
+ public:
+ HsW01(BaseObject* creator);
+ virtual ~HsW01() {}
+
+ virtual void fire();
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ private:
+ void setMaterial(const std::string& material);
+ std::string& getMaterial();
+ void setDelay(float d);
+ float getDelay() const;
+ void shot();
+ void muendungsfeuer();
+
+ std::string material_;
+ float speed_;
+ float delay_;
+ Timer<HsW01> delayTimer_;
+ };
+}
+
+#endif /* _HsW01_H__ */
Modified: branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc 2009-05-18 13:38:22 UTC (rev 2982)
+++ branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc 2009-05-18 14:29:40 UTC (rev 2983)
@@ -33,7 +33,7 @@
#include "core/XMLPort.h"
#include "objects/weaponsystem/projectiles/ParticleProjectile.h"
#include "objects/worldentities/Model.h"
-#include "objects/worldentities/MuzzleFlash.h"
+#include "objects/weaponsystem/MuzzleFlash.h"
#include "objects/weaponsystem/Weapon.h"
#include "objects/weaponsystem/WeaponPack.h"
Added: branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc~
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc~ (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc~ 2009-05-18 14:29:40 UTC (rev 2983)
@@ -0,0 +1,121 @@
+/*
+ * 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:
+ * Hagen Seifert
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "HsW01.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/weaponsystem/projectiles/ParticleProjectile.h"
+#include "objects/worldentities/Model.h"
+#include "objects/worldentities/MuzzleFlash.h"
+
+#include "objects/weaponsystem/Weapon.h"
+#include "objects/weaponsystem/WeaponPack.h"
+#include "objects/weaponsystem/WeaponSystem.h"
+
+namespace orxonox
+{
+ CreateFactory(HsW01);
+
+ HsW01::HsW01(BaseObject* creator) : WeaponMode(creator)
+ {
+ RegisterObject(HsW01);
+
+ this->reloadTime_ = 0.25;
+ this->damage_ = 15;
+ this->speed_ = 2500;
+ this->delay_ = 0;
+ this->setMunitionName("HsW01");
+
+ this->delayTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&HsW01::shot)));
+ this->delayTimer_.stopTimer();
+ }
+
+ void HsW01::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(HsW01, XMLPort, xmlelement, mode);
+
+ XMLPortParam(HsW01, "delay", setDelay, getDelay, xmlelement, mode);
+ XMLPortParam(HsW01, "material", setMaterial, getMaterial, xmlelement, mode);
+
+ }
+
+ void HsW01::setMaterial(const std::string& material)
+ {
+ this->material_ = material;
+ }
+
+ std::string& HsW01::getMaterial()
+ {
+ return this->material_;
+ }
+
+ void HsW01::setDelay(float d)
+ {
+ this->delay_ = d;
+ this->delayTimer_.setInterval(this->delay_);
+ }
+
+ float HsW01::getDelay() const
+ {
+ return this->delay_;
+ }
+
+ void HsW01::fire()
+ {
+ this->delayTimer_.startTimer();
+ }
+
+ void HsW01::muendungsfeuer()
+ {
+ MuzzleFlash *muzzleFlash = new MuzzleFlash(this);
+ this->getWeapon()->attach(muzzleFlash);
+ muzzleFlash->setPosition(this->getMuzzleOffset());
+ muzzleFlash->setMaterial(this->material_);
+ }
+
+ void HsW01::shot()
+ {
+ Projectile* projectile = new Projectile(this);
+ Model* model = new Model(projectile);
+ model->setMeshSource("laserbeam.mesh");
+ model->setCastShadows(false);
+ projectile->attach(model);
+ model->setScale(5);
+
+ projectile->setOrientation(this->getMuzzleOrientation());
+ projectile->setPosition(this->getMuzzlePosition());
+ projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
+
+ projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ projectile->setDamage(this->getDamage());
+
+ HsW01::muendungsfeuer();
+ }
+}
Added: branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h~
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h~ (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h~ 2009-05-18 14:29:40 UTC (rev 2983)
@@ -0,0 +1,62 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _HsW01_H__
+#define _HsW01_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/weaponsystem/WeaponMode.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport HsW01 : public WeaponMode
+ {
+ public:
+ HsW01(BaseObject* creator);
+ virtual ~HsW01() {}
+
+ virtual void fire();
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ private:
+ void setMaterial(const std::string& material);
+ std::string& getMaterial();
+ void setDelay(float d);
+ float getDelay() const;
+ void shot();
+ void muendungsfeuer();
+
+ std::string material_;
+ float speed_;
+ float delay_;
+ Timer<HsW01> delayTimer_;
+ };
+}
+
+#endif /* _HsW01_H__ */
More information about the Orxonox-commit
mailing list