예제 #1
0
void UniversalArrangeCMPT::GetPhysicsStaticVisitor::
visit(Object* object, bool& bFetchNext)
{
	ISprite* sprite = static_cast<ISprite*>(object);
	if (!sprite->getBody())
	{
		bFetchNext = true;
		return;
	}

	b2Body* body = sprite->getBody()->getBody();
	if (m_type == e_uncertain)
	{
		m_type = (body->GetType() == b2_staticBody) ? e_checked : e_unchecked;
		bFetchNext = true;
	}
	else if ((m_type == e_unchecked && body->GetType() == b2_staticBody)
		|| (m_type == e_checked && body->GetType() != b2_staticBody))
	{
		m_type = e_uncertain;
		bFetchNext = false;
	}
	else
	{
		bFetchNext = true;
	}
}
예제 #2
0
void UniversalArrangeCMPT::SetPhysicsStaticVisitor::
visit(Object* object, bool& bFetchNext)
{
	ISprite* sprite = static_cast<ISprite*>(object);
	if (sprite->getBody())
		sprite->getBody()->getBody()->SetType(m_bChecked ? b2_staticBody : b2_dynamicBody);

	bFetchNext = true;
}