当前位置: 首页>>代码示例>>C++>>正文


C++ Explosion::Add方法代码示例

本文整理汇总了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;
		}
	}
}
开发者ID:CurtisBuckoll,项目名称:SpaceGame,代码行数:18,代码来源:Collision.cpp

示例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;
		}
	}
}
开发者ID:CurtisBuckoll,项目名称:SpaceGame,代码行数:20,代码来源:Collision.cpp

示例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;
			}
		}
	}
}
开发者ID:CurtisBuckoll,项目名称:SpaceGame,代码行数:21,代码来源:Collision.cpp


注:本文中的Explosion::Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。