本文整理汇总了C++中CGameObject::Translate方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameObject::Translate方法的具体用法?C++ CGameObject::Translate怎么用?C++ CGameObject::Translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameObject
的用法示例。
在下文中一共展示了CGameObject::Translate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Activate
void CActivatable::Activate()
{
if (m_fTimer >= m_fCoolDown)
{
if (m_ID == 0)
{
XMMATRIX spawnMatrix = m_Owner->GetWorldMatrix();
spawnMatrix;
XMFLOAT4X4 spawn;
XMFLOAT3 trans = m_Owner->GetAxis(2);
XMMATRIX translation = XMMatrixTranslation(trans.x * -400, trans.y * -400, trans.z * -400);
XMStoreFloat4x4(&spawn, spawnMatrix * translation);
spawnedObject = m_Owner->GetObjMan()->CreateObject("FallenTree", spawn, m_Owner->GetEventSystem());
CSphereTrigger* trigger = (CSphereTrigger*)(spawnedObject->GetComponent("SphereTrigger"));
trigger->eTriggerType = TriggerType::eTreeWall;
CCollisionManager* manager = CManager::GetInstance()->m_ColManager;
vector<CGameObject*> explosionVec = manager->OverlapSphere(spawnedObject->GetPosition(), 240, CapsuleType::eCapEnemy);
for (CGameObject* explodeOBj : explosionVec)
{
CUnitStats* someStats = ((CUnitStats*)explodeOBj->GetComponent("UnitStats"));
if (someStats != nullptr)
{
someStats->TakeDamage((float)-170);
int statusInt = 0;
//float slowAmt = 80;
//if (slowAmt > 0.0f)
//{
// ((CEnemyController*)explodeOBj->GetComponent("EnemyController"))->SetSlowedStatus(slowAmt);
//}
}
}
}
else if (m_ID == 1)
{
XMMATRIX bulletMat = m_Owner->GetWorldMatrix();
XMFLOAT4X4 m;
XMStoreFloat4x4(&m, bulletMat);
CGameObject* pBullet = m_Owner->GetObjMan()->CreateObject("Bolt", m, m_Owner->GetEventSystem());
pBullet->Translate(XMFLOAT3(0, 122, 0));
auto bulletTrigger = (CSphereTrigger*)pBullet->GetComponent("SphereTrigger");
bulletTrigger->eTriggerType = TriggerType::eBullet;
CBulletController* bull = (CBulletController*)pBullet->GetComponent("BulletController");
bull->SetWhoShotMe(m_Owner);
bull->SetPiercing(true);
bull->SetLifeTime(2.5f);
bull->SetBouncing(false);
m_animation = 1;
}
else if (m_ID == 2)
{
XMMATRIX bulletMat = m_Owner->GetWorldMatrix();
XMFLOAT4X4 m;
XMStoreFloat4x4(&m, bulletMat);
CGameObject* pBullet = m_Owner->GetObjMan()->CreateObject("FallingStalactite", m, m_Owner->GetEventSystem());
pBullet->Rotate(-90, 0, 0);
auto bulletTrigger = (CSphereTrigger*)pBullet->GetComponent("SphereTrigger");
bulletTrigger->eTriggerType = TriggerType::eBullet;
CBulletController* bull = (CBulletController*)pBullet->GetComponent("BulletController");
bull->SetWhoShotMe(m_Owner);
bull->SetPiercing(true);
float height = m_Owner->GetPosition().y;
bull->SetLifeTime(1.0f * height / 1950.0f);
bull->SetBouncing(false);
bull->SetExploding(1);
}
else if (m_ID = 3)
{
float pushbackZ = -1350;
CCollisionManager* manager = CManager::GetInstance()->m_ColManager;
XMFLOAT3 collisionPos = XMFLOAT3(2900.0f, 25.0f, -3500.0f);
vector<CGameObject*> pushVec = manager->OverlapSphere(collisionPos, 4000, CapsuleType::eCapEnemy);
for (CGameObject* pushOBj : pushVec)
{
if (pushOBj->GetPosition().z < pushbackZ)
{
CUnitStats* someStats = ((CUnitStats*)pushOBj->GetComponent("UnitStats"));
if (someStats != nullptr)
{
someStats->TakeDamage((float)-170);
int statusInt = 0;
float slowAmt = .80f;
if (slowAmt > 0.0f)
{
((CEnemyController*)pushOBj->GetComponent("EnemyController"))->SetSlowedStatus(slowAmt,6.0f);
}
}
((CEnemyController*)pushOBj->GetComponent("EnemyController"))->pushbackTimer = 4.5f;
}
}
XMFLOAT4X4 t;
XMMATRIX tMat = XMMatrixTranslation(-1500.0f, 250.0f, -2500.0f);
XMStoreFloat4x4(&t, tMat);
CGameObject* pWater = m_Owner->GetObjMan()->CreateObject("WaterWave", t, m_Owner->GetEventSystem());
tMat = XMMatrixTranslation(-1500.0f, 250.0f, -3000.0f);
XMStoreFloat4x4(&t, tMat);
pWater = m_Owner->GetObjMan()->CreateObject("WaterWave", t, m_Owner->GetEventSystem());
tMat = XMMatrixTranslation(-1500.0f, 250.0f, -3750.0f);
XMStoreFloat4x4(&t, tMat);
//.........这里部分代码省略.........