本文整理汇总了C++中CEntity::sendMsg方法的典型用法代码示例。如果您正苦于以下问题:C++ CEntity::sendMsg方法的具体用法?C++ CEntity::sendMsg怎么用?C++ CEntity::sendMsg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEntity
的用法示例。
在下文中一共展示了CEntity::sendMsg方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: energyDecreasal
void CPlayerBase::energyDecreasal(float howmuch) {
PROFILE_FUNCTION("player base: energy dec function");
CEntity * raijin = tags_manager.getFirstHavingTag(getID("raijin"));
TMsgSetDamage msg;
msg.dmg = howmuch;
raijin->sendMsg(msg);
}
示例2: setAnim
//animaciones parciales
void TCompSkelController::setAnim(std::vector<std::string> anim, bool loop, std::vector<std::string> nextLoop)
{
if (!owner.isValid()) return;
CEntity* eOwner = owner;
TMsgSetAnim msgAnim;
msgAnim.name = anim;
msgAnim.loop = loop;
msgAnim.nextLoop = nextLoop;
eOwner->sendMsg(msgAnim);
}
示例3: spawnPrefab
CHandle spawnPrefab(const std::string& prefab) {
CHandle h = createPrefab(prefab);
//Le avisamos que se ha creado
CEntity* e = h;
TMsgEntityCreated msg;
e->sendMsg(msg);
//Devolvemos handle de la entidad creada
return h;
}
示例4: onEndElement
void CEntityParser::onEndElement(const std::string &elem) {
//if (loading_control) GameController->AddLoadingState(0.f); // for update
if (!hasToParse(elem)) return;
if (curr_prefab_compiler) {
CPrefabCompiler::TCall c;
c.is_start = false;
c.elem = elem;
curr_prefab_compiler->calls.push_back(c);
}
if (MUST_COMPILE_SNOOZER) {
CPrefabCompiler::TCall c;
c.is_start = false;
c.elem = elem;
curr_slept_compiler->calls.push_back(c);
}
//dbg("Bye from %s\n", elem.c_str());
if (elem == "entity") {
if (!curr_entity.isValid()) return;
handles.push_back(curr_entity);
if (curr_slept_compiler) {
auto hmSnoozer = CHandleManager::getByName("snoozer");
CHandle snoozer = hmSnoozer->createHandle();
CEntity * e = curr_entity;
e->add(snoozer);
TMsgPreload msgPreload;
msgPreload.comps = curr_slept_compiler;
e->sendMsg(msgPreload);
}
// Keep track of the first entity found in the file
if (!root_entity.isValid())
root_entity = curr_entity;
curr_entity = CHandle();
curr_slept_compiler = nullptr;
if (loading_control)
GameController->AddLoadingState(entity_load_value);
//GameController->AddLoadingState(entity_load_value - entity_load_accum);
}
//else {
// float to_add = 0.1 * entity_load_value;
// if (to_add + entity_load_accum > entity_load_value)
// to_add = entity_load_value - entity_load_accum;
// entity_load_accum += to_add;
// GameController->AddLoadingState(to_add);
//}
if (elem == "entities" || elem == "prefab") {
for (auto h : handles) {
CEntity*e = h;
dbg("Entity created!! [%s]\n", e->getName());
e->sendMsg(TMsgEntityCreated());
}
// Send the group has been created msg
TMsgEntityGroupCreated msg = { &handles };
for (auto h : handles)
((CEntity*)h)->sendMsg(msg);
}
}