Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 4, 2010, 11:56:26 AM (14 years ago)
Author:
dafrick
Message:

Lots of things done in pickups module. Compiles, but it seems, that I've also introduced an error preventing steering of the spaceship.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup3/src/modules/pickup/PickupSpawner.cc

    r6421 r6466  
    3939#include "core/XMLPort.h"
    4040#include "worldentities/pawns/Pawn.h"
     41#include "PickupManager.h"
     42#include "PickupRepresentation.h"
    4143//#include "PickupInventory.h"    // HACK; Only for hack, remove later
    4244
     
    5961    PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator)
    6062    {
     63        RegisterObject(PickupSpawner);
     64       
    6165        this->initialize();
     66       
     67        PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(NULL);
     68       
     69        COUT(1) << "MUP4 " << representation << std::endl;
     70        this->attach(representation->getSpawnerRepresentation(this));
     71       
     72        COUT(1) << "MUP6" << std::endl;
    6273    }
    6374
     
    7889    PickupSpawner::PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems) : StaticEntity(creator)
    7990    {
     91        RegisterObject(PickupSpawner);
     92       
    8093        this->initialize();
    8194 
     
    8598        this->respawnTime_ = respawnTime;
    8699        this->setMaxSpawnedItems(maxSpawnedItems);
     100       
     101        PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getPickupIdentifier());
     102        this->attach(representation->getSpawnerRepresentation(this));
    87103    }
    88104
     
    93109    void PickupSpawner::initialize(void)
    94110    {
    95         RegisterObject(PickupSpawner);
    96 
    97111        this->pickup_ = NULL;
    98112       
     
    215229        Time since last tick.
    216230    */
    217     //TODO: Replace this with a real DistanceTrigger?
     231    //TODO: Replace this with a real DistanceTrigger? Or better with collisions?
    218232    void PickupSpawner::tick(float dt)
    219233    {
     
    259273            if (pickup != NULL) //!< If everything went ok, and pickup is not NULL.
    260274            {
     275                //TODO: Not correct anymore.
    261276                PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(pawn);
    262277                if(carrier == NULL)
     
    266281                }
    267282               
    268                 if(pickup->pickup(carrier))
     283                if(carrier->pickup(pickup))
    269284                {
    270285                    COUT(3) << "Pickup got picked up." << std::endl;
Note: See TracChangeset for help on using the changeset viewer.