本文整理汇总了C++中Obj_Character::DirectTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj_Character::DirectTo方法的具体用法?C++ Obj_Character::DirectTo怎么用?C++ Obj_Character::DirectTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj_Character
的用法示例。
在下文中一共展示了Obj_Character::DirectTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
BOOL StdImpact072_T::GetTargetPos( OWN_IMPACT& rImp, Obj_Character &rMe, WORLD_POS& oTargetPos, FLOAT& fDistance ) const
{
__ENTER_FUNCTION
TargetingAndDepletingParams_T& rParams = rMe.GetTargetingAndDepletingParams();
//计算方向
FLOAT fMaxDistance = (FLOAT)GetDistance( rImp );
ID_t nTargetMode = rMe.GetSkillInfo().GetTargetingLogic();
if( INVALID_ID == nTargetMode )
{
//g_pLog->FastSaveLog( LOG_FILE_1, "瞬移技能 error, INVALID_ID == nTargetMode" );
return FALSE;
}
WORLD_POS oMyPos = *(rMe.getWorldPos());
if( TARGET_POS == nTargetMode )
{
oTargetPos = rParams.GetTargetPosition();
fDistance = GetFinalDistance(rMe, oMyPos, oTargetPos, fMaxDistance);
}
else if( TARGET_SPECIFIC_UNIT == nTargetMode )
{
ObjID_t iID = rParams.GetTargetObj();
Obj_Character* pTag = (Obj_Character*)rMe.getScene()->GetObjManager()->GetObj( iID );
if( NULL == pTag )
{
//g_pLog->FastSaveLog( LOG_FILE_1, "瞬移技能 error, NULL == pTag" );
return FALSE;
}
oTargetPos = *(pTag->getWorldPos());
fDistance = GetFinalDistance(rMe, oMyPos, oTargetPos, fMaxDistance);
fDistance -= 0.5f;
}
else if( TARGET_SELF == nTargetMode )
{
fDistance = fMaxDistance;
oTargetPos = *(rMe.getWorldPos());
FLOAT fDir = rParams.GetTargetDirection();
oTargetPos.m_fX += sinf( fDir ) * fDistance;
oTargetPos.m_fZ += cosf( fDir ) * fDistance;
}
else
{
//g_pLog->FastSaveLog( LOG_FILE_1, "瞬移技能 error, TargetMode invalid" );
return FALSE;
}
if( fDistance < 0.005f )
{
rMe.DirectTo( &oMyPos, FALSE );
//g_pLog->FastSaveLog( LOG_FILE_1, "瞬移技能 OK, but too near to target" );
return FALSE;
}
return TRUE;
__LEAVE_FUNCTION
return FALSE;
}