本文整理汇总了C++中DroidComponent类的典型用法代码示例。如果您正苦于以下问题:C++ DroidComponent类的具体用法?C++ DroidComponent怎么用?C++ DroidComponent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DroidComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findStimPack
StimPack* DroidStimpackModuleDataComponent::findStimPack() {
StimPack* pack = NULL;
float biggest = 0;
DroidComponent* container = cast<DroidComponent*>(getParent());
if (container == NULL)
return NULL;
ManagedReference<SceneObject*> craftingComponents = container->getSlottedObject("crafted_components");
if (craftingComponents != NULL) {
SceneObject* satchel = craftingComponents->getContainerObject(0);
for (int i = 0; i < satchel->getContainerObjectsSize(); ++i) {
ManagedReference<SceneObject*> sceno = satchel->getContainerObject(i);
// is a stimpack
if (sceno->isPharmaceuticalObject()) {
PharmaceuticalObject* pharma = sceno.castTo<PharmaceuticalObject*>();
if (pharma->isStimPack() && !pharma->isPetStimPack() && !pharma->isDroidRepairKit()) {
StimPack* stim = cast<StimPack*>(pharma);
if (stim->getEffectiveness() > biggest) {
biggest = stim->getEffectiveness();
pack = stim;
}
}
}
}
}
return pack;
}
示例2: copy
void DroidMaintenanceModuleDataComponent::copy(BaseDroidModuleComponent* other){
DroidMaintenanceModuleDataComponent* otherModule = cast<DroidMaintenanceModuleDataComponent*>(other);
if( otherModule == NULL )
return;
moduleRating = otherModule->moduleRating;
// Save stat in parent sceno
DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
if (droidComponent == NULL)
return;
droidComponent->addProperty("struct_module", moduleRating, 0, "exp_effectiveness");
if (moduleRating < 6) {
maxStructures = 3;
} else if (moduleRating < 12) {
maxStructures = 6;
} else if (moduleRating < 15) {
maxStructures = 9;
} else {
maxStructures = 10;
}
}
示例3: processModule
void DroidDeedImplementation::processModule(BaseDroidModuleComponent* module, uint32 crc) {
if (module == NULL)
return;
if (module->isStackable()) {
if (modules.containsKey(module->getModuleName())) {
// add to the stack if stackable.
DroidComponent* comp = modules.get(module->getModuleName());
BaseDroidModuleComponent* bmodule = cast<BaseDroidModuleComponent*>(comp->getDataObjectComponent()->get());
bmodule->addToStack(module);
} else {
ManagedReference<DroidComponent*> dcomp = (this->getZoneServer()->createObject(crc,1)).castTo<DroidComponent*>();
dcomp->setParent(NULL);
BaseDroidModuleComponent* bmodule = cast<BaseDroidModuleComponent*>(dcomp->getDataObjectComponent()->get());
bmodule->copy(module);
bmodule->setSpecies(species);
modules.put(module->getModuleName(),dcomp);
}
} else {
ManagedReference<DroidComponent*> dcomp = (this->getZoneServer()->createObject(crc,1)).castTo<DroidComponent*>();
dcomp->setParent(NULL);
BaseDroidModuleComponent* bmodule = cast<BaseDroidModuleComponent*>(dcomp->getDataObjectComponent()->get());
bmodule->copy(module);
bmodule->setSpecies(species);
modules.put(module->getModuleName(),dcomp);
}
}
示例4: compatibleStimpack
StimPack* DroidStimpackModuleDataComponent::compatibleStimpack(float power) {
DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
if (droidComponent == NULL) {
info("droidComponent was null");
return NULL;
}
DroidObject* droid = getDroidObject();
if (droid == NULL) {
return NULL;
}
Locker dlock(droid);
ManagedReference<SceneObject*> craftingComponents = droidComponent->getSlottedObject("crafted_components");
if(craftingComponents != NULL) {
SceneObject* satchel = craftingComponents->getContainerObject(0);
if(satchel == NULL) {
return NULL;
}
for (int i = 0; i < satchel->getContainerObjectsSize(); ++i) {
SceneObject* item = satchel->getContainerObject(i);
if (!item->isTangibleObject())
continue;
TangibleObject* tano = cast<TangibleObject*>( item);
if (tano->isPharmaceuticalObject()) {
StimPack* stim = cast<StimPack*>(tano);
if(stim->getEffectiveness() == power) {
return stim;
}
}
}
}
return NULL;
}
示例5: addToStack
void DroidMaintenanceModuleDataComponent::addToStack(BaseDroidModuleComponent* other){
DroidMaintenanceModuleDataComponent* otherModule = cast<DroidMaintenanceModuleDataComponent*>(other);
if( otherModule == NULL )
return;
// Maintenance modules do not stack. Just keep the highest rated module
if( otherModule->moduleRating > moduleRating )
moduleRating = otherModule->moduleRating;
// Save stat in parent sceno
DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
if (droidComponent == NULL)
return;
// Attribute should have already been created in copy method
if( !droidComponent->changeAttributeValue( "struct_module", moduleRating) ){
info( "addToStack updateAttributeValue failed");
return;
}
if (moduleRating < 6) {
maxStructures = 3;
} else if (moduleRating < 12) {
maxStructures = 6;
} else if (moduleRating < 15) {
maxStructures = 9;
} else {
maxStructures = 10;
}
}
示例6: setSpecies
void DroidDetonationModuleDataComponent::setSpecies(int i) {
species = i;
mseDroid = i == DroidObject::MSE;
DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
if (droidComponent != NULL) {
droidComponent->addProperty("species", (float)species, 0, "hidden", true);
}
}
示例7: initializeTransientMembers
void DroidDetonationModuleDataComponent::initializeTransientMembers() {
// Pull module stat from parent sceno
DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
if (droidComponent == NULL) {
info("droidComponent was null");
return;
}
/*for (int i = 0; i < droidComponent->getPropertyCount(); i++) {
String prop = droidComponent->getProperty(i);
}*/
if (droidComponent->hasKey("bomb_level")) {
rating = droidComponent->getAttributeValue("bomb_level");
}
if (droidComponent->hasKey("module_count")) {
moduleCount = droidComponent->getAttributeValue("module_count");
}
if (droidComponent->hasKey("module_init")) {
initialized = droidComponent->getAttributeValue("module_init") == 1;
}
if (droidComponent->hasKey("species")) {
species = droidComponent->getAttributeValue("species");
}
if (species == DroidObject::MSE) {
mseDroid = true;
}
}
示例8: copy
void DroidStimpackModuleDataComponent::copy(BaseDroidModuleComponent* other) {
DroidStimpackModuleDataComponent* otherModule = cast<DroidStimpackModuleDataComponent*>(other);
if(otherModule == NULL)
return;
speed = speed + otherModule->speed;
capacity = capacity + otherModule->capacity;
DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
if (droidComponent != NULL) {
droidComponent->addProperty("stimpack_speed",(float)speed,0,"exp_effectiveness");
droidComponent->addProperty("stimpack_capacity",(float)capacity,0,"exp_durability");
}
}
示例9: addToStack
void DroidStimpackModuleDataComponent::addToStack(BaseDroidModuleComponent* other) {
DroidStimpackModuleDataComponent* otherModule = cast<DroidStimpackModuleDataComponent*>(other);
if(otherModule == NULL)
return;
speed = speed + otherModule->speed;
capacity = capacity + otherModule->capacity;
DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
if (droidComponent != NULL) {
droidComponent->changeAttributeValue("stimpack_capacity",(float)capacity);
droidComponent->changeAttributeValue("stimpack_speed",(float)speed);
}
}
示例10: initializeTransientMembers
void DroidMaintenanceModuleDataComponent::initializeTransientMembers() {
// Pull module stat from parent sceno
DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
if (droidComponent == NULL) {
info("droidComponent was null");
return;
}
if( droidComponent->hasKey( "struct_module") ){
moduleRating = droidComponent->getAttributeValue( "struct_module");
}
}
示例11: initializeTransientMembers
void DroidStimpackModuleDataComponent::initializeTransientMembers() {
DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
if (droidComponent == NULL) {
info("droidComponent was null");
return;
}
if(droidComponent->hasKey( "stimpack_capacity")) {
capacity = droidComponent->getAttributeValue( "stimpack_capacity");
}
if (droidComponent->hasKey("stimpack_speed")) {
speed = droidComponent->getAttributeValue("stimpack_speed");
}
}
示例12: initializeTransientMembers
void DroidArmorModuleDataComponent::initializeTransientMembers() {
// Pull module stat from parent sceno
DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
if (droidComponent == NULL) {
info("droidComponent was null");
return;
}
if (droidComponent->hasKey("armor_module")) {
armorModule = droidComponent->getAttributeValue("armor_module");
}
}
示例13: copy
void DroidHarvestModuleDataComponent::copy(BaseDroidModuleComponent* other){
DroidHarvestModuleDataComponent* otherModule = cast<DroidHarvestModuleDataComponent*>(other);
if( otherModule == NULL )
return;
harvestBonus = otherModule->harvestBonus;
// Save stat in parent sceno
DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
if (droidComponent == NULL)
return;
droidComponent->addProperty("harvest_power", harvestBonus, 0, "exp_effectiveness");
}
示例14: addToStack
void DroidDetonationModuleDataComponent::addToStack(BaseDroidModuleComponent* other) {
DroidDetonationModuleDataComponent* otherModule = cast<DroidDetonationModuleDataComponent*>(other);
if (otherModule == NULL)
return;
rating = rating + otherModule->rating;
moduleCount += 1;
DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
if (droidComponent != NULL) {
droidComponent->changeAttributeValue("bomb_level", (float)rating);
droidComponent->changeAttributeValue("module_count", (float)moduleCount);
}
}
示例15: copy
void DroidDetonationModuleDataComponent::copy(BaseDroidModuleComponent* other) {
DroidDetonationModuleDataComponent* otherModule = cast<DroidDetonationModuleDataComponent*>(other);
if (otherModule == NULL)
return;
rating = otherModule->rating;
moduleCount = 1;
DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
if (droidComponent != NULL) {
droidComponent->addProperty("bomb_level", (float)rating, 0, "exp_effectiveness");
droidComponent->addProperty("module_count", (float)moduleCount, 0, "hidden", true);
droidComponent->addProperty("module_init", 0, 0, "hidden", true);
}
}