本文整理汇总了C++中Explosion::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ Explosion::Add方法的具体用法?C++ Explosion::Add怎么用?C++ Explosion::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Explosion
的用法示例。
在下文中一共展示了Explosion::Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShipsCollide
void Collision::ShipsCollide(Player* player, Enemy* enemy)
{
float collision_dist;
float actual_dist;
for (int i = 0; i < enemy->GetEnemyArraySize(); i++)
{
collision_dist = player->GetRadius() + enemy->GetRadius(i);
actual_dist = glm::distance(player->GetPosition(), enemy->GetPosition(i));
if (actual_dist <= collision_dist)
{
extern_Explosion.Add(player->GetPosition(), player->GetDirection());
enemy->Remove(i);
///Do something with player
break;
}
}
}
示例2: PlayerHit
void Collision::PlayerHit(Player* player, Enemy* enemy)
{
float collision_dist;
float actual_dist;
for (int i = 0; i < enemy->GetShotArraySize(); i++)
{
collision_dist = enemy->GetShotRadius(i) + player->GetRadius();
actual_dist = glm::distance(enemy->GetShotPosition(i), player->GetPosition());
if (actual_dist <= collision_dist)
{
extern_Explosion.Add(enemy->GetShotPosition(i), glm::vec3(0.0f, -1.0f, 0.0f));
enemy->RemoveShot(i);
player->DecrementHP();
//player->Delete();
///Do something with player
break;
}
}
}
示例3: EnemyHit
void Collision::EnemyHit(Player* player, Enemy* enemy)
{
float collision_dist;
float actual_dist;
for (int i = 0; i < player->GetShotArraySize(); i++)
{
for (int k = 0; k < enemy->GetEnemyArraySize(); k++)
{
collision_dist = player->GetShotRadius(i) + enemy->GetRadius(k);
actual_dist = glm::distance(player->GetShotPosition(i), enemy->GetPosition(k));
if (actual_dist <= collision_dist)
{
extern_Explosion.Add(player->GetShotPosition(i), glm::normalize(enemy->GetDirection(k)) + glm::vec3(0.0f, 1.0f, 0.0f) );
player->RemoveShot(i);
enemy->Remove(k);
break;
}
}
}
}