- Timestamp:
- Mar 5, 2010, 6:26:54 PM (15 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup3/src/modules/pickup/DroppedPickup.cc
r6466 r6475 23 23 * Daniel 'Huty' Haggenmueller 24 24 * Co-authors: 25 * ...25 * Damian 'Mozork' Frick 26 26 * 27 27 */ 28 28 29 #include "DroppedItem.h" 29 /** 30 @file 31 @brief Implementation of the DroppedPickup class. 32 */ 33 34 #include "DroppedPickup.h" 30 35 31 36 #include "core/CoreIncludes.h" … … 37 42 /** 38 43 @brief 39 Constructor. Registers object and sets default values.44 Default constructor. Registers object and sets default values. 40 45 */ 41 Dropped Item::DroppedItem(BaseObject* creator) : PickupSpawner(creator)46 DroppedPickup::DroppedPickup(BaseObject* creator) : PickupSpawner(creator) 42 47 { 48 RegisterObject(DroppedPickup); 49 43 50 this->initialize(); 44 }45 46 DroppedItem::DroppedItem(BaseObject* creator, Pickupable* item, const Vector3& position, float triggerDistance) : PickupSpawner(creator, item, triggerDistance, 0, 1)47 {48 this->initialize();49 50 this->createDrop(position);51 }52 53 void DroppedItem::initialize(void)54 {55 RegisterObject(DroppedItem);56 57 this->gotPickedUp_ = false;58 51 } 59 52 60 53 /** 61 54 @brief 62 Default destructor. 55 Constructor. Registers the object and sets values. 56 @param creator 57 The creator of the DroppedPickup. 58 @param pickup 59 The Pickupable that was dropped. 60 @param position 61 The position at which the DroppedPickup should be created. 62 @param triggerDistance 63 The distance at which the PickupSpawner triggers. Default is 10. 63 64 */ 64 DroppedItem::~DroppedItem() 65 DroppedPickup::DroppedPickup(BaseObject* creator, Pickupable* pickup, const Vector3& position, float triggerDistance) : PickupSpawner(creator, pickup, triggerDistance, 0, 1) 66 { 67 RegisterObject(DroppedPickup); 68 69 this->initialize(); 70 71 this->setPosition(position); 72 } 73 74 /** 75 @brief 76 Destructor. 77 */ 78 DroppedPickup::~DroppedPickup() 65 79 { 66 80 if(this->gotPickedUp_ && this->pickup_ != NULL) … … 69 83 } 70 84 } 85 86 /** 87 @brief 88 Initializes the member variables of the object. 89 */ 90 void DroppedPickup::initialize(void) 91 { 92 this->gotPickedUp_ = false; 93 } 71 94 72 Pickupable* DroppedItem::getPickup(void) 95 /** 96 @brief 97 Creates the Pickupable that is going to get picked up. 98 In the case of the DroppedItem it is the one and only Pickupable that was dropped. No additional Pickupables of the same type are created. 99 */ 100 Pickupable* DroppedPickup::getPickup(void) 73 101 { 74 102 return this->pickup_; 75 103 } 76 77 //TODO; Doesn't seem to be needed anymore, just put setPosition in the constructor.78 void DroppedItem::createDrop(const Vector3& position)79 {80 this->setPosition(position);81 82 //TODO: Make this work.83 //const Model& model = PickupManager::getModel(item->getPickupIdentifier());84 //this->attach(model);85 }86 104 87 //TODO: Remove.88 //TODO: Comment.89 //Each pickup should have a XML template where the Model and Billboard, and so on, is specified.90 // /*static*/ DroppedItem* DroppedItem::createDefaultDrop(BaseItem* item, const Vector3& position, const ColourValue& flareColour, float timeToLive)91 // {92 // //TODO: triggerDistance?93 // float triggerDistance = 20.0;94 // DroppedItem* droppedItem = new DroppedItem(item, item, triggerDistance, 0, 1);95 //96 // //TODO: Do this somehwere else?97 // Model* model = new Model(item);98 // Billboard* billboard = new Billboard(item);99 //100 // model->setMeshSource("sphere.mesh");101 // model->setScale(3.0f);102 //103 // billboard->setMaterial("Examples/Flare");104 // billboard->setColour(flareColour);105 // billboard->setScale(0.5f);106 //107 // droppedItem->setPosition(position);108 // droppedItem->attach(model);109 // droppedItem->attach(billboard);110 //111 // COUT(3) << "Created DroppedItem for '" << item->getPickupIdentifier() << "' at (" << position.x << "," << position.y << "," << position.z << ")." << std::endl;112 //113 // return droppedItem;114 // }115 116 //TODO: See one function above.117 // DroppedItem* DroppedItem::createDefaultDrop(BaseItem* item, Pawn* pawn, const ColourValue& flareColour, float timeToLive)118 // {119 // Vector3 after = pawn->getPosition() + pawn->getOrientation() * Vector3(0.0f, 0.0f, 50.0f);120 // return DroppedItem::createDefaultDrop(item, after, flareColour, timeToLive);121 // }122 105 }
Note: See TracChangeset
for help on using the changeset viewer.