- Timestamp:
- Mar 29, 2010, 12:30:32 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup4/src/modules/pickup/PickupManager.cc
r6540 r6632 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/LuaState.h" 38 #include "core/GUIManager.h" 37 39 #include "core/ScopedSingletonManager.h" 38 40 #include "core/Identifier.h" 39 41 #include "interfaces/PickupCarrier.h" 42 #include "infos/PlayerInfo.h" 40 43 #include "worldentities/pawns/Pawn.h" 41 44 #include "PickupRepresentation.h" 42 45 46 #include "ToluaBindPickup.h" 47 43 48 namespace orxonox 44 49 { 45 50 // Register tolua_open function when loading the library 51 DeclareToluaInterface(Pickup); 52 46 53 ManageScopedSingleton(PickupManager, ScopeID::Root, false); 54 55 /*static*/ const std::string PickupManager::guiName_s = "PickupInventory"; 47 56 48 57 /** … … 110 119 } 111 120 121 PickupCarrier* PickupManager::getPawn(void) 122 { 123 Pawn* pawn = dynamic_cast<Pawn*>(GUIManager::getInstancePtr()->getPlayer(PickupManager::guiName_s)->getControllableEntity()); 124 if(pawn == NULL) 125 return NULL; 126 return dynamic_cast<PickupCarrier*>(pawn); 127 } 128 129 unsigned int PickupManager::getNumCarrierChildren(PickupCarrier* carrier) 130 { 131 return carrier->getNumCarrierChildren(); 132 } 133 134 PickupCarrier* PickupManager::getCarrierChild(unsigned int index, PickupCarrier* carrier) 135 { 136 return carrier->getCarrierChild(index); 137 } 138 139 PickupRepresentation* PickupManager::getPickupRepresentation(unsigned int index, PickupCarrier* carrier) 140 { 141 Pickupable* pickup = carrier->getPickup(index); 142 if(pickup == NULL) 143 return NULL; 144 145 return this->getRepresentation(pickup->getPickupIdentifier()); 146 } 147 148 149 unsigned int PickupManager::getNumPickups(PickupCarrier* carrier) 150 { 151 return carrier->getNumPickups(); 152 } 153 154 void PickupManager::dropPickup(unsigned int index, PickupCarrier* carrier) 155 { 156 Pickupable* pickup = carrier->getPickup(index); 157 carrier->drop(pickup); 158 } 159 160 void PickupManager::usePickup(unsigned int index, PickupCarrier* carrier, bool use) 161 { 162 Pickupable* pickup = carrier->getPickup(index); 163 pickup->setUsed(use); 164 } 165 112 166 }
Note: See TracChangeset
for help on using the changeset viewer.