Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2186 for code


Ignore:
Timestamp:
Nov 12, 2008, 12:50:18 PM (16 years ago)
Author:
polakma
Message:

made some changes (still doesn't compile)

Location:
code/branches/weapon2/src/orxonox
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/branches/weapon2/src/orxonox/CMakeLists.txt

    r2106 r2186  
    9090  objects/weaponSystem/Weapon.cc
    9191  objects/weaponSystem/Munition.cc
     92  objects/weaponSystem/weapons/LaserGun.cc
     93  objects/weaponSystem/munitions/LaserGunMunition.cc
     94  objects/weaponSystem/projectiles/BillboardProjectile.cc
     95  objects/weaponSystem/projectiles/ParticleProjectile.cc
     96  objects/weaponSystem/projectiles/Projectile.cc
    9297
    9398  objects/worldentities/triggers/Trigger.cc
  • code/branches/weapon2/src/orxonox/OrxonoxPrereqs.h

    r2096 r2186  
    133133    class Weapon;
    134134    class Munition;
     135    class LaserGun;
     136    class LaserGunMunition;
    135137
    136138    class EventListener;
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.cc

    r2145 r2186  
    4242        RegisterObject(Weapon);
    4343        this->weaponReadyToShoot_ = true;
    44         //this->setParentWeaponSystem();
     44        this->setParentWeaponSystem();
     45        this->pointerToMunition_ = this->parentWeaponSystem_->getAttachedMunitionPointer;
     46        this->attachNeededMunition(this->pointerToMunition_);
    4547
    4648    }
     
    6668    }
    6769
    68     void Weapon::attachNeededMunition(Munition *PointerToMunition)
     70    void attachNeededMunition(Munition *pointerToMunition)
    6971    {
     72        //if munition type already exist attach it, else create a new one of this type and attach it to the weapon and to the WeaponSystem
     73        if ( this->parentWeaponSystem_->munitionSet_[laserGunMunition] )
     74            this->pointerToMunition_ = pointerToMunition;
     75        else
     76        {
     77            this->pointerToMunition_ = new LaserGunMunition;
     78            this->parentWeaponSystem_->munitionSet_[laserGunMunition] = this->pointerToMunition_;
    7079
     80        }
    7181    }
     82
    7283/*
    7384    void Weapon::setParentWeaponSystem()
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.h

    r2145 r2186  
    4848            virtual void fire();
    4949            void reloaded();
    50             virtual void attachNeededMunition(Munition *PointerToMunition);
     50            virtual void setParentWeaponSystem();
     51            void attachNeededMunition(Munition *munitionPointer);
    5152
    5253            inline void setParentWeaponSlot(WeaponSlot *parentWeaponSlot)
     
    5556                { return parentWeaponSlot_; };
    5657
    57             //void setParentWeaponSystem();
     58
     59
    5860
    5961        private:
     
    6264            Munition *pointerToMunition_;
    6365            WeaponSlot *parentWeaponSlot_;
    64             //WeaponSystem *parentWeaponSystem_;
     66            WeaponSystem *parentWeaponSystem_;
    6567            Timer<Weapon> reloadTimer_;
    6668
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSlot.h

    r2145 r2186  
    6363
    6464            WeaponSet *parentWeaponSet_;
     65
     66            //attached weapon orientation
     67            int yaw_ = 0;
     68            int pitch_ = 0;
     69            int roll_ = 0;
    6570    };
    6671}
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSystem.cc

    r2145 r2186  
    5252        this->activeWeaponSet_ = 0;
    5353        this->parentSpaceShip_ = 0;
    54         //this->attachedMunition_ =0;
     54        this->attachedMunition_ =0;
    5555    }
    5656
     
    8080    void WeaponSystem::fire(WeaponMode::Enum n)
    8181    {
    82         if (n < this->weaponSets_.size())
     82        if (n < (int)this->weaponSets_.size())
    8383            this->weaponSets_[n]->fire();
    8484    }
     
    9898    }
    9999
    100     /*
     100    Munition * WeaponSystem::getAttachedMunitionPointer()
     101    {
     102        return this->attachedMunition_;
     103    }
     104
    101105    void WeaponSystem::addMunitionType(Munition *munitionPointer)
    102106    {
     
    106110            this->attachedMunition_ = munitionPointer;
    107111        else
    108             this->unlimitedAmmo_ = true;
     112            ;//was?
    109113
    110114    }
    111     */
     115
    112116
    113117}
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSystem.h

    r2145 r2186  
    4343    {
    4444        enum Enum
    45         { LaserGunMunition };
     45        { laserGunMunition };
    4646    }
    4747
     
    6868            //void setActiveWeaponSet(unsigned int n);
    6969            WeaponSet * getWeaponSetPointer(unsigned int n);
     70            Munition * getAttachedMunitionPointer();
    7071
    7172            inline void setParentSpaceShip(SpaceShip *parentSpaceShip)
     
    8081            WeaponSet *activeWeaponSet_;
    8182            SpaceShip *parentSpaceShip_;
     83            Munition * attachedMunition_;
    8284    };
    8385}
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.cc

    r2097 r2186  
    3737namespace orxonox
    3838{
    39     LaserGunMunition::LaserGunMunition(BaseObject* creator) : BaseObject(creator)
     39    LaserGunMunition::LaserGunMunition(BaseObject* creator) : Munition(creator)
    4040    {
    4141        RegisterObject(LaserGunMunition);
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.h

    r2145 r2186  
    3333
    3434#include "core/BaseObject.h"
    35 
     35#include "../Munition.h"
    3636
    3737namespace orxonox
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc

    r2145 r2186  
    3434#include "util/Debug.h"
    3535
     36#include "LaserGun.h"
     37
    3638
    3739namespace orxonox
     
    4143        RegisterObject(LaserGun);
    4244
    43         this->attachNeededMunition();
    44 
    4545        //set weapon properties here
    46         this->projectileColor_ = ColourValue(1.0, 1.0, 0.5)
    4746        this->loadingTime_ = 0.5;
    4847    }
     
    7675    }
    7776
    78     ColorValue LaserGun::getProjectileColor()
    79     {
    80         return projectileColor_;
    81     }
    82 
    83     void attachNeededMunition(Munition *pointerToMunition)
    84     {
    85         //if munition type already exist attach it, else create a new one of this type and attach it to the weapon and to the WeaponSystem
    86         if ( this->parentWeaponSystem_->munitionSet_[laserGunMunition] )
    87             this->pointerToMunition_ = pointerToMunition;
    88         else
    89         {
    90             this->pointerToMunition_ = new LaserGunMunition;
    91 
    92         }
    93     }
    9477}
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.h

    r2145 r2186  
    3434#include "core/BaseObject.h"
    3535
    36 #include "LaserGunMunition.h"
     36#include "../munitions/LaserGunMunition.h"
    3737#include "util/Math.h"
     38#include "../Weapon.h"
    3839
    3940namespace orxonox
     
    4849
    4950            void fire();
    50             ColourValue LaserGun::getProjectileColour();
     51
    5152
    5253        private:
    53             ColorValue projectileColor_;
     54
    5455
    5556    };
Note: See TracChangeset for help on using the changeset viewer.