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


C++ TileMap::findCollision方法代码示例

本文整理汇总了C++中TileMap::findCollision方法的典型用法代码示例。如果您正苦于以下问题:C++ TileMap::findCollision方法的具体用法?C++ TileMap::findCollision怎么用?C++ TileMap::findCollision使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TileMap的用法示例。


在下文中一共展示了TileMap::findCollision方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: checkProjectileCollision

Collision Projectile::checkProjectileCollision(TileMap &map)
{
	if (!this->tileObject)
	{
		// It's possible the projectile reached the end of it's lifetime this frame
		// so ignore stuff without a tile
		return {};
	}

	sp<TileObject> ignoredObject = nullptr;
	if (ownerInvulnerableTicks > 0)
	{
		if (firerVehicle)
		{
			ignoredObject = firerVehicle->tileObject;
		}
		else if (firerUnit)
		{
			ignoredObject = firerUnit->tileObject;
		}
	}
	Collision c = map.findCollision(this->previousPosition, this->position, {}, ignoredObject);
	if (!c)
		return {};

	c.projectile = shared_from_this();
	return c;
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: test_collision

static void test_collision(const TileMap &map, Vec3<float> line_start, Vec3<float> line_end,
                           sp<TileObject> expected_collision)
{
	auto collision = map.findCollision(line_start, line_end);
	if (collision.obj != expected_collision)
	{
		LogError("Line between {%f,%f,%f} and {%f,%f,%f} collided with %s, expected %s",
		         line_start.x, line_start.y, line_start.z, line_end.x, line_end.y, line_end.z,
		         collision.obj ? collision.obj->getName() : "NONE",
		         expected_collision ? expected_collision->getName() : "NONE");
		exit(EXIT_FAILURE);
	}
}
开发者ID:JonnyH,项目名称:OpenApoc,代码行数:13,代码来源:test_tilemap.cpp

示例3: checkProjectileCollision

Collision Projectile::checkProjectileCollision(TileMap &map)
{
	if (!this->tileObject)
	{
		// It's possible the projectile reached the end of it's lifetime this frame
		// so ignore stuff without a tile
		return {};
	}

	Collision c = map.findCollision(this->previousPosition, this->position);
	if (c && c.obj->getType() == TileObject::Type::Vehicle &&
	    this->firer == std::static_pointer_cast<TileObjectVehicle>(c.obj)->getVehicle())
	{
		return {};
	}

	c.projectile = shared_from_this();
	return c;
}
开发者ID:ShadowDancer,项目名称:OpenApoc,代码行数:19,代码来源:projectile.cpp


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