Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 18, 2009, 6:14:52 PM (15 years ago)
Author:
landauf
Message:

Added many new features in the Munition class:

  • there are now 3 modes: a) every weapon has it's own magazine b) all weapons use the same magazin c) no magazines, just a big munition pool
  • the Munition class handles the reloading of the magazine

Split the Weapon class into Weapon and WeaponMode. WeaponMode creates the fire of the Weapon. A weapon can own several WeaponModes (for example primary and secondary fire). But it's also possible to have a weapon with several muzzles which all fire at the same time (there's a WeaponMode for each muzzle).

Renamed LaserGun to LaserFire and Fusion to FusionFire. They inherit now from WeaponMode.

Changed the code in the Weapon class to use the new Munition functionality.

Added ReplenishingMunition, a subclass of Munition that replenishes itself (used for LaserGunMunition).

Added a reload command to reload magazines.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • code/branches/weapons/src/orxonox/objects/weaponSystem/weapons/FusionFire.cc

    • Property svn:mergeinfo set to (toggle deleted branches)
      /code/branches/gui/src/orxonox/objects/weaponSystem/weapons/Fusion.ccmergedeligible
      /code/branches/pickups/src/orxonox/objects/weaponSystem/weapons/Fusion.ccmergedeligible
      /code/branches/pickups2/src/orxonox/objects/weaponSystem/weapons/Fusion.ccmergedeligible
      /code/branches/weaponsystem/src/orxonox/objects/weaponSystem/weapons/Fusion.ccmergedeligible
      /code/branches/buildsystem/src/orxonox/objects/weaponSystem/weapons/Fusion.cc1874-2276,​2278-2400
      /code/branches/buildsystem2/src/orxonox/objects/weaponSystem/weapons/Fusion.cc2506-2658
      /code/branches/buildsystem3/src/orxonox/objects/weaponSystem/weapons/Fusion.cc2662-2708
      /code/branches/ceguilua/src/orxonox/objects/weaponSystem/weapons/Fusion.cc1802-1808
      /code/branches/core3/src/orxonox/objects/weaponSystem/weapons/Fusion.cc1572-1739
      /code/branches/gcc43/src/orxonox/objects/weaponSystem/weapons/Fusion.cc1580
      /code/branches/input/src/orxonox/objects/weaponSystem/weapons/Fusion.cc1629-1636
      /code/branches/lodfinal/src/orxonox/objects/weaponSystem/weapons/Fusion.cc2372-2411
      /code/branches/miniprojects/src/orxonox/objects/weaponSystem/weapons/Fusion.cc2754-2824
      /code/branches/network/src/orxonox/objects/weaponSystem/weapons/Fusion.cc2356
      /code/branches/network64/src/orxonox/objects/weaponSystem/weapons/Fusion.cc2210-2355
      /code/branches/objecthierarchy/src/orxonox/objects/weaponSystem/weapons/Fusion.cc1911-2085,​2100,​2110-2169
      /code/branches/objecthierarchy2/src/orxonox/objects/weaponSystem/weapons/Fusion.cc2171-2479
      /code/branches/overlay/src/orxonox/objects/weaponSystem/weapons/Fusion.cc2117-2385
      /code/branches/physics/src/orxonox/objects/weaponSystem/weapons/Fusion.cc1912-2055,​2107-2439
      /code/branches/physics_merge/src/orxonox/objects/weaponSystem/weapons/Fusion.cc2436-2457
      /code/branches/presentation/src/orxonox/objects/weaponSystem/weapons/Fusion.cc2369-2652,​2654-2660
      /code/branches/questsystem/src/orxonox/objects/weaponSystem/weapons/Fusion.cc1894-2088
      /code/branches/questsystem2/src/orxonox/objects/weaponSystem/weapons/Fusion.cc2107-2259
      /code/branches/script_trigger/src/orxonox/objects/weaponSystem/weapons/Fusion.cc1295-1953,​1955
      /code/branches/weapon/src/orxonox/objects/weaponSystem/weapons/Fusion.cc1925-2094
      /code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/Fusion.cc2107-2488
    r2914 r2918  
    2828
    2929#include "OrxonoxStableHeaders.h"
    30 #include "Fusion.h"
     30#include "FusionFire.h"
    3131
    3232#include "core/CoreIncludes.h"
     33#include "objects/weaponSystem/projectiles/BillboardProjectile.h"
    3334
    34 #include "objects/weaponSystem/Munition.h"
    35 #include "objects/weaponSystem/projectiles/ParticleProjectile.h"
     35#include "objects/weaponSystem/Weapon.h"
     36#include "objects/weaponSystem/WeaponPack.h"
    3637#include "objects/weaponSystem/WeaponSystem.h"
    3738
    3839namespace orxonox
    3940{
    40     CreateFactory(Fusion);
     41    CreateFactory(FusionFire);
    4142
    42     Fusion::Fusion(BaseObject* creator) : Weapon(creator)
     43    FusionFire::FusionFire(BaseObject* creator) : WeaponMode(creator)
    4344    {
    44         RegisterObject(Fusion);
     45        RegisterObject(FusionFire);
    4546
     47        this->reloadTime_ = 1.0;
     48        this->bParallelReload_ = false;
     49        this->damage_ = 40;
    4650        this->speed_ = 1250;
    4751
     52        this->setMunitionName("FusionMunition");
    4853    }
    4954
    50     Fusion::~Fusion()
     55    void FusionFire::fire()
    5156    {
    52     }
     57        BillboardProjectile* projectile = new BillboardProjectile(this);
    5358
    54     void Fusion::takeBullets()
    55     {
    56 //COUT(0) << "Fusion::takeBullets" << std::endl;
    57         this->munition_->removeBullets(1);
    58         this->bulletTimer(this->bulletLoadingTime_);
    59     }
     59        projectile->setOrientation(this->getMuzzleOrientation());
     60        projectile->setPosition(this->getMuzzlePosition());
     61        projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
    6062
    61     void Fusion::takeMagazines()
    62     {
    63         this->munition_->removeMagazines(1);
    64         this->magazineTimer(this->magazineLoadingTime_);
    65     }
    66 
    67     void Fusion::createProjectile()
    68     {
    69 //COUT(0) << "Fusion::createProjectile" << std::endl;
    70         BillboardProjectile* projectile = new ParticleProjectile(this);
    71         projectile->setOrientation(this->getWorldOrientation());
    72         projectile->setPosition(this->getWorldPosition());
    73         projectile->setVelocity(this->getWorldOrientation() * WorldEntity::FRONT * this->speed_);
    74         projectile->setOwner(this->getWeaponSystem()->getPawn());
     63        projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
     64        projectile->setDamage(this->getDamage());
     65        projectile->setColour(ColourValue(1.0f, 0.7f, 0.3f, 1.0f));
    7566    }
    7667}
Note: See TracChangeset for help on using the changeset viewer.