42 lines
1004 B
C++
42 lines
1004 B
C++
|
|
#include "SGameUtil.h"
|
|
|
|
|
|
void GetDirection( K3DMatrix &Out, const K3DVector &StartPos, const K3DVector &EndPos )
|
|
{
|
|
K3DVector xVector, yVector, zVector;
|
|
yVector = StartPos-EndPos;
|
|
yVector.Normalize();
|
|
zVector = K3DVector( 0, 0, 1 );
|
|
|
|
K3DVectorCross( xVector, zVector, yVector );
|
|
xVector.Normalize();
|
|
K3DVectorCross( zVector, xVector, yVector );
|
|
zVector.Normalize();
|
|
|
|
K3DMatrixIdentity( Out );
|
|
|
|
Out._11 = xVector.x; Out._12 = xVector.y; Out._13 = xVector.z;
|
|
Out._21 = yVector.x; Out._22 = yVector.y; Out._23 = yVector.z;
|
|
Out._31 = zVector.x; Out._32 = zVector.y; Out._33 = zVector.z;
|
|
}
|
|
|
|
|
|
float GetAniPlayRate( DWORD attack_speed, DWORD dwMaxTime, bool bRealTime )
|
|
{
|
|
float fAniRate = 4.8f;
|
|
float fBaseAttackRate;
|
|
|
|
//msec 변환
|
|
if( bRealTime == false )
|
|
fBaseAttackRate = dwMaxTime/fAniRate; //SMTP
|
|
else
|
|
fBaseAttackRate = (float)dwMaxTime; //msec
|
|
|
|
fAniRate = fBaseAttackRate/(attack_speed);
|
|
|
|
if( dwMaxTime == 0 )
|
|
fAniRate = 1.f;
|
|
|
|
return fAniRate; //기본 배율이 4.8f 는 1배
|
|
} |