当前位置: 首页>>代码示例>>C++>>正文


C++ CEntity::sendMsg方法代码示例

本文整理汇总了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);
}
开发者ID:DopaminaInTheVein,项目名称:ItLightens,代码行数:8,代码来源:player_controller_base.cpp

示例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);
}
开发者ID:DopaminaInTheVein,项目名称:ItLightens,代码行数:11,代码来源:skel_controller.cpp

示例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;
}
开发者ID:DopaminaInTheVein,项目名称:ItLightens,代码行数:11,代码来源:entity_parser.cpp

示例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);
	}
}
开发者ID:DopaminaInTheVein,项目名称:ItLightens,代码行数:63,代码来源:entity_parser.cpp


注:本文中的CEntity::sendMsg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。