本文整理汇总了C++中TransportInfo::GetLocalPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ TransportInfo::GetLocalPosition方法的具体用法?C++ TransportInfo::GetLocalPosition怎么用?C++ TransportInfo::GetLocalPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransportInfo
的用法示例。
在下文中一共展示了TransportInfo::GetLocalPosition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Launch
int32 MoveSplineInit::Launch()
{
MoveSpline& move_spline = *unit.movespline;
TransportInfo* transportInfo = unit.GetTransportInfo();
Location real_position(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZ(), unit.GetOrientation());
// If boarded use current local position
if (transportInfo)
transportInfo->GetLocalPosition(real_position.x, real_position.y, real_position.z, real_position.orientation);
// there is a big chane that current position is unknown if current state is not finalized, need compute it
// this also allows calculate spline position and update map position in much greater intervals
if (!move_spline.Finalized() && !transportInfo)
real_position = move_spline.ComputePosition();
if (args.path.empty())
{
// should i do the things that user should do?
MoveTo(real_position);
}
// corrent first vertex
args.path[0] = real_position;
args.initialOrientation = real_position.orientation;
uint32 moveFlags = unit.m_movementInfo.GetMovementFlags();
if (args.flags.walkmode)
moveFlags |= MOVEFLAG_WALK_MODE;
else
moveFlags &= ~MOVEFLAG_WALK_MODE;
moveFlags |= (MOVEFLAG_SPLINE_ENABLED | MOVEFLAG_FORWARD);
if (args.velocity == 0.f)
args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags));
if (!args.Validate(&unit))
return 0;
unit.m_movementInfo.SetMovementFlags((MovementFlags)moveFlags);
move_spline.Initialize(args);
WorldPacket data(SMSG_MONSTER_MOVE, 64);
data << unit.GetPackGUID();
if (transportInfo)
{
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
data << transportInfo->GetTransportGuid().WriteAsPacked();
data << int8(transportInfo->GetTransportSeat());
}
PacketBuilder::WriteMonsterMove(move_spline, data);
unit.SendMessageToSet(&data, true);
return move_spline.Duration();
}
示例2: Stop
void MoveSplineInit::Stop()
{
MoveSpline& move_spline = *unit.movespline;
// No need to stop if we are not moving
if (move_spline.Finalized())
return;
TransportInfo* transportInfo = unit.GetTransportInfo();
Location real_position(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZ(), unit.GetOrientation());
// If boarded use current local position
if (transportInfo)
transportInfo->GetLocalPosition(real_position.x, real_position.y, real_position.z, real_position.orientation);
// there is a big chane that current position is unknown if current state is not finalized, need compute it
// this also allows calculate spline position and update map position in much greater intervals
if (!move_spline.Finalized() && !transportInfo)
real_position = move_spline.ComputePosition();
if (args.path.empty())
{
// should i do the things that user should do?
MoveTo(real_position);
}
// corrent first vertex
args.path[0] = real_position;
args.flags = MoveSplineFlag::Done;
unit.m_movementInfo.RemoveMovementFlag(MovementFlags(MOVEFLAG_FORWARD | MOVEFLAG_CAN_FLY));
move_spline.Initialize(args);
WorldPacket data(SMSG_MONSTER_MOVE, 64);
data << unit.GetPackGUID();
if (transportInfo)
{
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
data << transportInfo->GetTransportGuid().WriteAsPacked();
data << int8(transportInfo->GetTransportSeat());
}
data << uint8(0);
data << real_position.x << real_position.y << real_position.z;
data << move_spline.GetId();
data << uint8(MonsterMoveStop);
unit.SendMessageToSet(&data, true);
}
示例3: MoveTo
int32 MoveSplineInit<GameObject*>::Launch()
{
MoveSpline& move_spline = *gameobject.movespline;
TransportInfo* transportInfo = gameobject.GetTransportInfo();
Position real_position = transportInfo ?
transportInfo->GetLocalPosition() :
gameobject.GetPosition();
// there is a big chane that current position is unknown if current state is not finalized, need compute it
// this also allows calculate spline position and update map position in much greater intervals
if (!move_spline.Finalized())
real_position = move_spline.ComputePosition();
if (args.path.empty())
{
// form final position only for rotate
if (!args.flags.isFacing())
return 0;
MoveTo(real_position);
}
else
{
// check path equivalence
if (!args.flags.isFacing() && args.path[0] == args.path[args.path.size() - 1])
return 0;
}
// corrent first vertex
args.path[0] = real_position;
args.initialOrientation = real_position.orientation;
if (fabs(args.velocity) < M_NULL_F)
return 0;
// args.velocity = gameobject.GetSpeed();
move_spline.Initialize(args);
return move_spline.Duration();
}
示例4: data
int32 MoveSplineInit<Unit*>::Launch()
{
MoveSpline& move_spline = *unit.movespline;
TransportInfo* transportInfo = unit.GetTransportInfo();
Position real_position = transportInfo ?
transportInfo->GetLocalPosition() :
unit.GetPosition();
// there is a big chane that current position is unknown if current state is not finalized, need compute it
// this also allows calculate spline position and update map position in much greater intervals
if (!move_spline.Finalized() && !transportInfo)
real_position = move_spline.ComputePosition();
if (args.path.empty())
{
// form final position only for rotate
if (!args.flags.isFacing())
return 0;
MoveTo(real_position);
}
else
{
// check path equivalence
if (!args.flags.isFacing() && args.path[0] == args.path[args.path.size() - 1])
return 0;
}
// corrent first vertex
args.path[0] = real_position;
args.initialOrientation = real_position.orientation;
uint32 moveFlags = unit.m_movementInfo.GetMovementFlags();
if (args.flags.walkmode)
moveFlags |= MOVEFLAG_WALK_MODE;
else
moveFlags &= ~MOVEFLAG_WALK_MODE;
moveFlags |= (MOVEFLAG_SPLINE_ENABLED | MOVEFLAG_FORWARD);
if (fabs(args.velocity) < M_NULL_F)
args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags));
if (!args.Validate(&unit))
return 0;
if (moveFlags & MOVEFLAG_ROOT)
moveFlags &= ~MOVEFLAG_MASK_MOVING;
unit.m_movementInfo.SetMovementFlags((MovementFlags)moveFlags);
move_spline.Initialize(args);
WorldPacket data(SMSG_MONSTER_MOVE, 64);
data << unit.GetPackGUID();
if (transportInfo)
{
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
data << transportInfo->GetTransportGuid().WriteAsPacked();
data << int8(transportInfo->GetTransportSeat());
}
PacketBuilder::WriteMonsterMove(move_spline, data);
unit.SendMessageToSet(&data, true);
return move_spline.Duration();
}