本文整理汇总了C++中ViewObject::getMovementInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewObject::getMovementInfo方法的具体用法?C++ ViewObject::getMovementInfo怎么用?C++ ViewObject::getMovementInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewObject
的用法示例。
在下文中一共展示了ViewObject::getMovementInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMovementOffset
Vec2 MapGui::getMovementOffset(const ViewObject& object, Vec2 size, double time, int curTimeReal) {
if (!object.hasAnyMovementInfo())
return Vec2(0, 0);
double state;
Vec2 dir;
if (screenMovement &&
curTimeReal >= screenMovement->startTimeReal &&
curTimeReal <= screenMovement->endTimeReal) {
state = (double(curTimeReal) - screenMovement->startTimeReal) /
(screenMovement->endTimeReal - screenMovement->startTimeReal);
dir = object.getMovementInfo(screenMovement->startTimeGame, screenMovement->endTimeGame,
screenMovement->creatureId);
} else if (object.hasAnyMovementInfo() && !screenMovement) {
ViewObject::MovementInfo info = object.getLastMovementInfo();
dir = info.direction;
if (info.direction.length8() == 0 || time >= info.tEnd || time <= info.tBegin)
return Vec2(0, 0);
state = (time - info.tBegin) / (info.tEnd - info.tBegin);
double minStopTime = 0.2;
state = min(1.0, max(0.0, (state - minStopTime) / (1.0 - 2 * minStopTime)));
} else
return Vec2(0, 0);
if (object.getLastMovementInfo().type == ViewObject::MovementInfo::ATTACK)
if (dir.length8() == 1)
return Vec2(0.8 * (state < 0.5 ? state : 1 - state) * dir.x * size.x,
(0.8 * (state < 0.5 ? state : 1 - state)* dir.y - getJumpOffset(object, state)) * size.y);
return Vec2((state - 1) * dir.x * size.x, ((state - 1)* dir.y - getJumpOffset(object, state)) * size.y);
}