Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2864


Ignore:
Timestamp:
Mar 30, 2009, 2:27:26 PM (15 years ago)
Author:
danielh
Message:

first commit of pickup system

  • working PickupCollection
  • working PickupSpawner
  • base classes for items
  • updated Pawn to include PickupCollection
  • updated Projectile to use damage modifier on hit
Location:
code/branches/pickups/src/orxonox/objects
Files:
15 added
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickups/src/orxonox/objects/pickup/CMakeLists.txt

    r2831 r2864  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    2 
     2  BaseItem.cc
     3  EquipmentItem.cc
     4  ModifierPickup.cc
     5  PassiveItem.cc
     6  PickupCollection.cc
     7  PickupSpawner.cc
     8  UsableItem.cc
    39)
  • code/branches/pickups/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc

    r2809 r2864  
    124124
    125125            Pawn* victim = dynamic_cast<Pawn*>(otherObject);
     126
     127            float dmg = this->damage_;
     128            if (this->owner_)
     129                dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
     130
    126131            if (victim)
    127                 victim->damage(this->damage_, this->owner_);
     132                victim->damage(dmg, this->owner_);
    128133        }
    129134        return false;
  • code/branches/pickups/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2831 r2864  
    3333#include "core/CoreIncludes.h"
    3434#include "core/XMLPort.h"
    35 #include "util/Exception.h"
    3635#include "util/Math.h"
    3736#include "PawnManager.h"
     
    6261        this->spawnparticleduration_ = 3.0f;
    6362
     63        this->getPickups().setOwner(this);
     64
    6465        if (Core::isMaster())
    6566        {
     
    204205            this->setDestroyWhenPlayerLeft(false);
    205206
     207            this->dropItems();
     208
    206209            if (this->getGametype())
    207210                this->getGametype()->pawnKilled(this, this->lastHitOriginator_);
     
    266269    void Pawn::dropItems()
    267270    {
    268         ThrowException(NotImplemented, "Pickupsystem not implemented yet.");
     271        this->getPickups().clear();
    269272    }
    270273
  • code/branches/pickups/src/orxonox/objects/worldentities/pawns/Pawn.h

    r2831 r2864  
    3434#include "objects/RadarViewable.h"
    3535#include "objects/weaponSystem/WeaponSystem.h"
     36#include "objects/pickup/PickupCollection.h"
    3637
    3738namespace orxonox
     
    107108
    108109            virtual void dropItems();
     110            inline PickupCollection& getPickups()
     111                { return this->pickups_; }
    109112
    110113        protected:
     
    115118            bool bAlive_;
    116119
     120            PickupCollection pickups_;
    117121
    118122            float health_;
Note: See TracChangeset for help on using the changeset viewer.