本文整理汇总了C++中ManagedReference::broadcastMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ ManagedReference::broadcastMessage方法的具体用法?C++ ManagedReference::broadcastMessage怎么用?C++ ManagedReference::broadcastMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ManagedReference
的用法示例。
在下文中一共展示了ManagedReference::broadcastMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: notifyPositionUpdate
void DetectorZoneComponent::notifyPositionUpdate(SceneObject* sceneObject, QuadTreeEntry* entry) const {
ManagedReference<SceneObject*> target = cast<SceneObject*>(entry);
if(!sceneObject->isTangibleObject() || target == NULL){
return;
}
ManagedReference<TangibleObject*> tano = cast<TangibleObject*>(sceneObject);
DataObjectComponentReference* ref = sceneObject->getDataObjectComponent();
if(ref == NULL){
info("data is null",true);
return;
}
DetectorDataComponent* scannerData = cast<DetectorDataComponent*>(ref->get());
if(scannerData == NULL || !scannerData->canScan())
return;
if(sceneObject->isDetector() && target->isPlayerCreature() && sceneObject->isInRange(target,65)){
ManagedReference<CreatureObject*> player = cast<CreatureObject*>(entry);
if(player == NULL)
return;
ManagedReference<PlayerObject*> playerObject = player->getPlayerObject();
if(playerObject == NULL)
return;
if(tano->getFaction() != player->getFaction() && player->getFaction() != 0 ){
scannerData->updateCooldown();
PlayClientEffectLoc* explodeLoc = new PlayClientEffectLoc("clienteffect/survey_effect.cef", tano->getZone()->getZoneName(), tano->getPositionX(), tano->getPositionZ(), tano->getPositionY());
tano->broadcastMessage(explodeLoc, false);
}
}
return;
}
示例2: doFlourish
void EntertainingSessionImplementation::doFlourish(int flourishNumber) {
ManagedReference<CreatureObject*> entertainer = this->entertainer.get();
int fid = flourishNumber;
if (!dancing && !playingMusic) {
entertainer->sendSystemMessage("@performance:flourish_not_performing");
return;
}
PerformanceManager* performanceManager = SkillManager::instance()->getPerformanceManager();
Performance* performance = NULL;
ManagedReference<Instrument*> instrument = getInstrument(entertainer);
if (dancing)
performance = performanceManager->getDance(performanceName);
else if (playingMusic && instrument)
performance = performanceManager->getSong(performanceName, instrument->getInstrumentType());
else {
cancelSession();
return;
}
if (!performance) { // shouldn't happen
StringBuffer msg;
msg << "Performance was null. Please report to www.swgemu.com/bugs ! Name: " << performanceName << " and Type: " << dec << instrument->getInstrumentType();
entertainer->sendSystemMessage(msg.toString());
return;
}
float baseActionDrain = performance->getActionPointsPerLoop() - (int)(entertainer->getHAM(CreatureAttribute::QUICKNESS)/35.f);
//float baseActionDrain = -40 + (getQuickness() / 37.5);
float flourishActionDrain = baseActionDrain / 2.0;
int actionDrain = (int)round((flourishActionDrain * 10 + 0.5) / 10.0); // Round to nearest dec for actual int cost
if (entertainer->getHAM(CreatureAttribute::ACTION) <= actionDrain) {
entertainer->sendSystemMessage("@performance:flourish_too_tired");
} else {
entertainer->inflictDamage(entertainer, CreatureAttribute::ACTION, actionDrain, false, true);
if (dancing) {
StringBuffer msg;
msg << "skill_action_" << fid;
entertainer->doAnimation(msg.toString());
} else if (playingMusic) {
Flourish* flourish = new Flourish(entertainer, fid);
entertainer->broadcastMessage(flourish, true);
}
//check to see how many flourishes have occurred this tick
if(flourishCount < 5) {
// Add buff
addEntertainerFlourishBuff();
// Grant Experience
if(flourishCount < 2)
flourishXp += performance->getBaseXp() + performance->getFlourishXpMod();
flourishCount++;
}
entertainer->notifyObservers(ObserverEventType::FLOURISH, entertainer, fid);
entertainer->sendSystemMessage("@performance:flourish_perform");
}
}