本文整理汇总了C++中CServerDE::GetVelocity方法的典型用法代码示例。如果您正苦于以下问题:C++ CServerDE::GetVelocity方法的具体用法?C++ CServerDE::GetVelocity怎么用?C++ CServerDE::GetVelocity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CServerDE
的用法示例。
在下文中一共展示了CServerDE::GetVelocity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
DBOOL CProjectile::Update(DVector *pMovement)
{
CServerDE* pServerDE = BaseClass::GetServerDE();
if (!pServerDE) return DFALSE;
pServerDE->SetNextUpdate(m_hObject, (DFLOAT)0.001);
// pServerDE->BPrint("hit points %f", m_damage.GetHitPoints());
if (m_bExplode || m_damage.IsDead())
{
Explode();
return DFALSE;
}
if (m_fLifeTime > 0)
{
DFLOAT fTime = pServerDE->GetTime();
if(fTime > (m_fStartTime + m_fLifeTime))
{
return DFALSE;
}
}
DVector vVel, vPos;
pServerDE->GetVelocity(m_hObject, &vVel);
pServerDE->GetObjectPos(m_hObject, &vPos);
if (m_hSmokeTrail)
{
pServerDE->SetObjectPos(m_hSmokeTrail, &vPos);
}
if (m_hLight)
{
pServerDE->SetObjectPos(m_hLight, &vPos);
}
return DTRUE;
}
示例2: ApplyDamagePhysics
void CDestructable::ApplyDamagePhysics(DFLOAT fDamage, DVector *pvDir)
{
CServerDE* pServerDE = BaseClass::GetServerDE();
if (!pServerDE || !m_hObject || !pvDir) return;
// Don't apply damage physics if the object is a trapped character (Andy 2/22/99)
if(IsBaseCharacter(m_hObject))
{
CBaseCharacter *pObj = (CBaseCharacter*)pServerDE->HandleToObject(m_hObject);
if(pObj->IsTrapped()) return;
}
if (VEC_MAGSQR(*pvDir) < 0.01) return;
DVector vTemp, vVel;
pServerDE->GetVelocity(m_hObject, &vVel);
VEC_COPY(vTemp, *pvDir);
VEC_NORM(vTemp);
if (m_fMass <= 0) m_fMass = 1;
DFLOAT fMultiplier = (fDamage * PA_DAMAGE_VEL_MUTLIPLIER) / m_fMass;
VEC_MULSCALAR(vTemp, vTemp, fMultiplier);
VEC_ADD(vVel, vTemp, vVel);
// Accumulate damage velocity for player objects to send to the client..
if (IsPlayer(m_hObject))
{
VEC_ADD(m_vAddVelocity, m_vAddVelocity, vTemp);
m_bAddVelocity = DTRUE;
}
pServerDE->SetVelocity(m_hObject, &vVel);
}
示例3: Update
//.........这里部分代码省略.........
VEC_ADD(vPos, vPos, vTemp);
// vPos is a point in front of you.
// vDir is a point in front of you, but down
VEC_COPY(vDir, vPos);
vDir.y = vDir.y - m_fUpOffset;
vDir.x = vDir.x - m_fRightOffset;
vDir.z = vDir.z - m_fForwardOffset;
VEC_COPY(vPos, vDir);
ObjectCreateStruct theStruct;
INIT_OBJECTCREATESTRUCT(theStruct);
theStruct.m_Flags = FLAG_VISIBLE;
theStruct.m_ObjectType = OT_SPRITE;
VEC_COPY(theStruct.m_Pos, vPos);
theStruct.m_SkinName[0] = '\0';
theStruct.m_NextUpdate = 0.0f;
_mbscpy((unsigned char*)theStruct.m_Filename, (const unsigned char*)"Sprites\\gibflame.spr");
VEC_COPY(theStruct.m_Scale, m_vScale)
HCLASS hClass = pServerDE->GetClass("BaseClass");
if (hClass)
{
LPBASECLASS pSprite = pServerDE->CreateObject(hClass, &theStruct);
m_hSprite[x] = pSprite->m_hObject;
if (!m_hLinkObject) return DFALSE;
DVector vVel;
pServerDE->GetVelocity(m_hLinkObject, &vVel);
pServerDE->SetVelocity(pSprite->m_hObject, &vVel);
}
// Add Smoke
/* {
ObjectCreateStruct theStruct;
INIT_OBJECTCREATESTRUCT(theStruct);
pServerDE->GetObjectPos(m_hSprite[x], &vPos);
vPos.y = vPos.y + 5;
VEC_COPY(theStruct.m_Pos, vPos);
HCLASS hClass = pServerDE->GetClass("CClientSmokeTrail");
CClientSmokeTrail* pTrail = DNULL;
if (hClass)
{
pTrail = (CClientSmokeTrail*)pServerDE->CreateObject(hClass, &theStruct);
}
if (pTrail)
{
DVector vVel;
if (!m_hLinkObject) return DFALSE;
pServerDE->GetVelocity(m_hLinkObject, &vVel);
pTrail->Setup(vVel, DFALSE);
m_hSmokeTrail[x] = pTrail->m_hObject;
}
} */