Example #1
0
	void Transform::OnDestroy(void)
	{
		Transform* current = firstChild;

		for(; current != 0; current = current->nextSibling)
			Game::destroy( current->GetGameObject() );
	}
Example #2
0
	GameObject* Transform::FindInHierarchy(RegistrationId nameHash)
	{
		GameObject* gameObject = GetGameObject();
		if( gameObject->GetNameHash() == nameHash )
			return gameObject;

		for(Transform* child = firstChild; child != 0; child = child->nextSibling)
		{
			GameObject* result = child->GetGameObject()->GetTransform()->FindInHierarchy(nameHash);

			if( result != 0 )
				return result;
		}

		return 0;		
	}
Example #3
0
	GameObject* Transform::Find(RegistrationId nameHash)
	{
		GameObject* gameObject = GetGameObject();
		if( gameObject->GetNameHash() == nameHash )
			return gameObject;

		for(Transform* child = firstChild; child != 0; child = child->nextSibling)
		{
			GameObject* childObject = child->GetGameObject();
			RegistrationId childNameHash = childObject->GetNameHash();

			if( childNameHash == nameHash )
				return childObject;
		}

		return 0;		
	}
Example #4
0
	Transform::Transform(const Transform& rhs)
	{
		parent = 0;
		firstChild = 0;
		nextSibling = 0;
		dirtied = modified = false;
		localMatrix.makeIdentity();
		worldMatrix.makeIdentity();

		Transform* current = rhs.firstChild;

		for(; current != 0; current = current->nextSibling )
		{
			GameObject* newGameObj = current->GetGameObject()->clone();
			newGameObj->GetTransform()->SetParent( this );
		}

		localMatrix = rhs.localMatrix;
		worldMatrix = rhs.worldMatrix;

		DirtyTransform();
	}