コード例 #1
0
ファイル: Drone.cpp プロジェクト: DominikWidomski/Cpp
bool Drone::CollisionTest(SmartPtr<GameObject> o)
{
//    if (o->GetType() != GameObjectType("Bullet")) return false;
    if (o->GetType() == GameObjectType("Drone")) return false;
	if (GetType() == o->GetType()) return false;
	if (mBoundingShape.GetPtr() == NULL) return false;
	if (o->GetBoundingShape().GetPtr() == NULL) return false;
	return mBoundingShape->CollisionTest(o->GetBoundingShape());
}
コード例 #2
0
ファイル: Asteroid.cpp プロジェクト: DominikWidomski/Cpp
bool Asteroid::CollisionTest(SmartPtr<GameObject> o)
{
    // Don't collide with objects of the same type
	if (GetType() == o->GetType()) return false;
	// If there's no bounding shape, don't do anything
	if (mBoundingShape.GetPtr() == NULL) return false;
	// If colliding object doesn't have a pointer to shape, don't do anything
	if (o->GetBoundingShape().GetPtr() == NULL) return false;
	// Otherwise, return the result of a collision test between bounding shapes
	return mBoundingShape->CollisionTest(o->GetBoundingShape());
}