本文整理汇总了C++中Being::setAction方法的典型用法代码示例。如果您正苦于以下问题:C++ Being::setAction方法的具体用法?C++ Being::setAction怎么用?C++ Being::setAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Being
的用法示例。
在下文中一共展示了Being::setAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleBeingEnterMessage
void BeingHandler::handleBeingEnterMessage(Net::MessageIn &msg)
{
int type = msg.readInt8();
int id = msg.readInt16();
Being::Action action = (Being::Action)msg.readInt8();
int px = msg.readInt16();
int py = msg.readInt16();
BeingDirection direction = (BeingDirection)msg.readInt8();
Being *being;
if (!Game::instance()->getCurrentMap()->containsPixel(px, py))
{
logger->log("Warning: Received GPMSG_BEING_ENTER for being id %i "
"with position outside the map boundaries "
"(x = %i, y = %i)", id, px, py);
return;
}
switch (type)
{
case OBJECT_CHARACTER:
{
std::string name = msg.readString();
if (player_node->getName() == name)
{
being = player_node;
being->setId(id);
}
else
{
being = actorSpriteManager->createBeing(id,
ActorSprite::PLAYER, 0);
being->setName(name);
}
int hs = msg.readInt8(), hc = msg.readInt8();
being->setSprite(SPRITE_HAIR, hs * -1, ColorDB::get(hc));
being->setGender(msg.readInt8() == GENDER_MALE ?
GENDER_MALE : GENDER_FEMALE);
handleLooks(being, msg);
} break;
case OBJECT_MONSTER:
case OBJECT_NPC:
{
int subtype = msg.readInt16();
being = actorSpriteManager->createBeing(id, type == OBJECT_MONSTER
? ActorSprite::MONSTER : ActorSprite::NPC, subtype);
std::string name = msg.readString();
if (name.length() > 0) being->setName(name);
} break;
default:
return;
}
being->setPosition(px, py);
being->setDestination(px, py);
being->setDirection(direction);
being->setAction(action);
}
示例2: handleBeingAttackMessage
void BeingHandler::handleBeingAttackMessage(Net::MessageIn &msg)
{
Being *being = actorSpriteManager->findBeing(msg.readInt16());
const BeingDirection direction = (BeingDirection) msg.readInt8();
const int attackType = msg.readInt8();
if (!being)
return;
being->setDirection(direction);
being->setAction(Being::ATTACK, attackType);
}
示例3: handleBeingActionChangeMessage
void BeingHandler::handleBeingActionChangeMessage(Net::MessageIn &msg)
{
Being *being = actorSpriteManager->findBeing(msg.readInt16());
Being::Action action = (Being::Action) msg.readInt8();
if (!being)
return;
being->setAction(action);
if (action == Being::DEAD && being == player_node)
{
static char const *const deadMsg[] =
{
_("You are dead."),
_("We regret to inform you that your character was killed in "
"battle."),
_("You are not that alive anymore."),
_("The cold hands of the grim reaper are grabbing for your soul."),
_("Game Over!"),
_("No, kids. Your character did not really die. It... err... "
"went to a better place."),
_("Your plan of breaking your enemies weapon by bashing it with "
"your throat failed."),
_("I guess this did not run too well."),
_("Do you want your possessions identified?"), // Nethack reference
_("Sadly, no trace of you was ever found..."), // Secret of Mana reference
_("Annihilated."), // Final Fantasy VI reference
_("Looks like you got your head handed to you."), // Earthbound reference
_("You screwed up again, dump your body down the tubes and get "
"you another one.") // Leisure Suit Larry 1 Reference
};
std::string message(deadMsg[rand()%13]);
message.append(std::string(" ") + _("Press OK to respawn."));
OkDialog *dlg = new OkDialog(_("You Died"), message, false);
dlg->addActionListener(&(ManaServ::respawnListener));
}
}