本文整理汇总了C++中PlayerObject::getPosture方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::getPosture方法的具体用法?C++ PlayerObject::getPosture怎么用?C++ PlayerObject::getPosture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::getPosture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleDataTransform
void ObjectController::handleDataTransform(Message* message,bool inRangeUpdate)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
if (!player)
{
gLogger->logMsgF("ObjectController::handleDataTransform Object is NOT A PLAYER, id = %"PRIu64"", MSG_HIGH, mObject->getId());
return;
}
glm::vec3 pos;
glm::quat dir;
uint32 inMoveCount;
uint32 tickCount;
float speed;
bool updateAll = false;
// get tick and move counters
tickCount = message->getUint32();
inMoveCount = message->getUint32();
// gLogger->logMsg("ObjectController::handleDataTransform");
//uint64 localTimeStart = Anh_Utils::Clock::getSingleton()->getLocalTime();
// only process if its in sequence
if(player->getInMoveCount() >= inMoveCount)
{
return;
}
//uint32 ticks = tickCount - player->getClientTickCount();
// update tick and move counters...
player->setLastMoveTick(tickCount);
player->setClientTickCount(tickCount);
player->setInMoveCount(inMoveCount);
if(player->checkIfMounted() && player->getMount())
{
//Player is mounted lets update his mount too
player->getMount()->setLastMoveTick(tickCount);
//player->getMount()->setInMoveCount((inMoveCount+1));
player->getMount()->setInMoveCount((inMoveCount)); // + 1 or nor does not matter, as long as we update inMoveCount.
}
// get new direction, position and speed
dir.x = message->getFloat();
dir.y = message->getFloat();
dir.z = message->getFloat();
dir.w = message->getFloat();
pos.x = message->getFloat();
pos.y = message->getFloat();
pos.z = message->getFloat();
speed = message->getFloat();
// gLogger->logMsgF("Position outside = %.2f, %.2f, %.2f",MSG_NORMAL, pos.x, pos.y, pos.z);
/*
if (Heightmap::isHeightmapCacheAvaliable())
{
gLogger->logMsgF("Heightmap value = %.2f",MSG_NORMAL, Heightmap::Instance()->getCachedHeightAt2DPosition(pos.x, pos.z));
}
*/
// gLogger->logMsgF("Direction = %f, %f, %f, %f",MSG_NORMAL, dir.x, dir.y, dir.z, dir.w);
// stop entertaining, if we were
// important is, that if we move we change our posture to NOT skill animating anymore!
// so only stop entertaining when we are performing and NOT skillanimationg
if(player->getPerformingState() != PlayerPerformance_None && player->getPosture() != CreaturePosture_SkillAnimating)
{
gEntertainerManager->stopEntertaining(player);
}
// if we just left a building
if(player->getParentId() != 0)
{
updateAll = true;
// Testing with 4 for add and 0 for remove.
// Remove us from previous cell.
gMessageLib->broadcastContainmentMessage(player->getId(),player->getParentId(),0,player);
// remove us from the last cell we were in
if(CellObject* cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(player->getParentId())))
{
cell->removeObject(player);
}
else
{
gLogger->logMsgF("Error removing %"PRIu64" from cell(%"PRIu64")",MSG_HIGH,player->getId(),player->getParentId());
}
// we are outside again
player->setParentId(0);
player->mPosition = pos;
// Add us to the world.
gMessageLib->broadcastContainmentMessage(player->getId(),0,4,player);
//.........这里部分代码省略.........
示例2: handleDataTransformWithParent
void ObjectController::handleDataTransformWithParent(Message* message,bool inRangeUpdate)
{
// FIXME: for now assume we only get messages from players
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
glm::vec3 pos;
glm::quat dir;
uint32 inMoveCount;
uint32 tickCount;
uint64 parentId;
float speed;
bool updateAll = false;
// get tick and move counters
tickCount = message->getUint32();
inMoveCount = message->getUint32();
// only process if its in sequence
if (player->getInMoveCount() <= inMoveCount)
{
uint64 oldParentId = player->getParentId();
//uint32 ticks = tickCount - player->getClientTickCount();
// update tick and move counters
player->setClientTickCount(tickCount);
player->setInMoveCount(inMoveCount);
// get new direction, position, parent and speed
parentId = message->getUint64();
dir.x = message->getFloat();
dir.y = message->getFloat();
dir.z = message->getFloat();
dir.w = message->getFloat();
pos.x = message->getFloat();
pos.y = message->getFloat();
pos.z = message->getFloat();
speed = message->getFloat();
// gLogger->logMsgF("Position inside = %f, %f, %f",MSG_NORMAL, pos.x, pos.y, pos.z);
// gLogger->logMsgF("Direction = %f, %f, %f, %f",MSG_NORMAL, dir.x, dir.y, dir.z, dir.w);
// stop entertaining, if we were
if(player->getPerformingState() != PlayerPerformance_None && player->getPosture() != CreaturePosture_SkillAnimating)
{
gEntertainerManager->stopEntertaining(player);
}
// if we changed cell
if (oldParentId != parentId)
{
CellObject* cell = NULL;
// gLogger->logMsgF("We changed cell from (%"PRIu64") to (%"PRIu64")",MSG_NORMAL, oldParentId, parentId);
// Remove us from whatever we where in before.
// (4 for add and 0 for remove)
gMessageLib->broadcastContainmentMessage(player->getId(),oldParentId,0,player);
// only remove us from si, if we just entered the building
if (oldParentId != 0)
{
if((cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(oldParentId))))
{
cell->removeObject(player);
// Done above.. gMessageLib->broadcastContainmentMessage(player->getId(),parentId,4,player);
}
else
{
gLogger->logMsgF("Error removing %"PRIu64" from cell(%"PRIu64")",MSG_NORMAL,player->getId(),oldParentId);
}
}
else
{
updateAll = true; // We just entered the building.
// remove us from qt
if(player->getSubZoneId())
{
if(QTRegion* region = gWorldManager->getQTRegion(player->getSubZoneId()))
{
player->setSubZoneId(0);
region->mTree->removeObject(player);
//If our player is mounted lets update his mount aswell
if(player->checkIfMounted() && player->getMount())
{
player->getMount()->setSubZoneId(0);
region->mTree->removeObject(player->getMount());
//Can't ride into a building with a mount! :-p
//However, its easy to do so we have handling incase the client is tricked.
// the vehicle is the INTANGIBLE Datapad Controller
// the *vehicle* itself is the BODY
if(Vehicle* datapad_pet = dynamic_cast<Vehicle*>(gWorldManager->getObjectById(player->getMount()->getPetController())))
{
//.........这里部分代码省略.........