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


C++ CreatureObject::isInCombat方法代码示例

本文整理汇总了C++中CreatureObject::isInCombat方法的典型用法代码示例。如果您正苦于以下问题:C++ CreatureObject::isInCombat方法的具体用法?C++ CreatureObject::isInCombat怎么用?C++ CreatureObject::isInCombat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CreatureObject的用法示例。


在下文中一共展示了CreatureObject::isInCombat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: notifyEnter

void FsVillageAreaImplementation::notifyEnter(SceneObject* player) {
	ActiveAreaImplementation::notifyEnter(player);

	if (!player->isPlayerCreature()) {
		return;
	}

	float x = player->getPositionX();
	float y = player->getPositionY();

	float diffY = y - getPositionY();
	float diffX = x - getPositionX();

	float angle = atan2(diffY == 0.f ? 1 : diffY, diffX == 0.f ? 1 : diffX);

	CreatureObject* playerCreature = cast<CreatureObject*>(player);
	PlayerObject* ghost = playerCreature->getPlayerObject();
	float rad = getRadius() * 1.05;

	float newPosX = getPositionX() + (cos(angle) * rad);
	float newPosY = getPositionY() + (sin(angle) * rad);

	// Those who aren't a valid player, do not currently have or have had the Village elder quest cannot enter.
	if (ghost != NULL) {
		if (ghost->hasGodMode())
			return;

		if (!ghost->hasActiveQuestBitSet(PlayerQuestData::FS_VILLAGE_ELDER) && !ghost->hasCompletedQuestsBitSet(PlayerQuestData::FS_VILLAGE_ELDER)) {
			playerCreature->teleport(newPosX, getZone()->getHeight(newPosX, newPosY), newPosY, 0);
			playerCreature->sendSystemMessage("@base_player:fs_village_unavailable");
		} else if (playerCreature->isInCombat()) {
			playerCreature->teleport(newPosX, getZone()->getHeight(newPosX, newPosY), newPosY, 0);
			playerCreature->sendSystemMessage("@base_player:fs_village_no_combat");
		}
	}
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:36,代码来源:FsVillageAreaImplementation.cpp


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