[2049] | 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 | * Martin Polak |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #include "OrxonoxStableHeaders.h" |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | #include "core/CoreIncludes.h" |
---|
| 33 | #include "core/XMLPort.h" |
---|
| 34 | #include "util/Debug.h" |
---|
| 35 | |
---|
[2186] | 36 | #include "LaserGun.h" |
---|
[2096] | 37 | |
---|
[2186] | 38 | |
---|
[2049] | 39 | namespace orxonox |
---|
| 40 | { |
---|
[2327] | 41 | CreateFactory(LaserGun); |
---|
| 42 | |
---|
[2097] | 43 | LaserGun::LaserGun(BaseObject* creator) : Weapon(creator) |
---|
[2049] | 44 | { |
---|
[2096] | 45 | RegisterObject(LaserGun); |
---|
| 46 | |
---|
[2145] | 47 | //set weapon properties here |
---|
[2232] | 48 | //this->setLoadingTime(0.5); |
---|
[2203] | 49 | |
---|
[2347] | 50 | COUT(0) << "LaserGun::LaserGun" << std::endl; |
---|
[2331] | 51 | this->attachNeededMunition(this->getMunitionType()); |
---|
[2049] | 52 | } |
---|
| 53 | |
---|
| 54 | LaserGun::~LaserGun() |
---|
| 55 | { |
---|
[2096] | 56 | } |
---|
| 57 | |
---|
[2203] | 58 | void LaserGun::fire() |
---|
[2096] | 59 | { |
---|
[2288] | 60 | COUT(0) << "LaserGun::fire" << std::endl; |
---|
[2232] | 61 | if ( this->getBulletReadyToShoot() && this->getMagazineReadyToShoot() ) |
---|
[2145] | 62 | { |
---|
[2347] | 63 | COUT(0) << "LaserGun::fire - ready to shoot" << std::endl; |
---|
[2145] | 64 | //take munition |
---|
[2347] | 65 | this->setBulletReadyToShoot(false); |
---|
| 66 | Weapon::bulletTimer(); |
---|
[2337] | 67 | this->getAttachedMunition(this->munitionType_)->removeBullets(1,this); |
---|
[2096] | 68 | |
---|
[2203] | 69 | //create projectile |
---|
[2272] | 70 | BillboardProjectile* projectile = new ParticleProjectile(this); |
---|
| 71 | projectile->setOrientation(projectile->getOrientation()); |
---|
| 72 | projectile->setPosition(projectile->getWorldPosition()); |
---|
| 73 | projectile->setVelocity(WorldEntity::FRONT * this->speed_); |
---|
| 74 | |
---|
[2203] | 75 | //projectile->setColour(this->getProjectileColour()); |
---|
[2145] | 76 | } |
---|
| 77 | else |
---|
| 78 | { |
---|
[2203] | 79 | //actions, when weapon is not reloaded if there are some |
---|
[2145] | 80 | } |
---|
[2096] | 81 | } |
---|
| 82 | |
---|
| 83 | void LaserGun::XMLPort(Element& xmlelement, XMLPort::Mode mode) |
---|
| 84 | { |
---|
| 85 | |
---|
| 86 | } |
---|
| 87 | |
---|
[2203] | 88 | |
---|
| 89 | |
---|
[2096] | 90 | } |
---|