Example #1
0
	void Layer2D::RaiseOnAdded()
	{
		OnAdded();

		for (auto& component : m_components->GetComponents())
		{
			component.second->RaiseOnAdded();
		}
	}
Example #2
0
	//----------------------------------------------------------------------------------
	//
	//----------------------------------------------------------------------------------
	void CoreLayer2D_Imp::AddObject(ObjectPtr object)
	{
		if (object->GetObjectType() == Object2DType::Camera)
		{
			auto camera = (CoreCameraObject2D_Imp*)object;
			m_cameras.push_back(camera);
			SafeAddRef(camera);
		}
		else
		{
			m_objects.push_back(object);
			SafeAddRef(object);
		}

		object->SetLayer(this);

		{
			auto o = CoreObject2DToImp(object);
			o->OnAdded(m_renderer);

#if __CULLING_2D__
			if (object->GetObjectType() == Object2DType::Map)
			{
				auto map = (CoreMapObject2D_Imp*)o;
				map->RegisterObjectToCulling();
				map->SetFirstSortedKey(world->GetNextFirstSortedKey());
				world->IncNextFirstSortedKey();
			}
			else if (object->GetObjectType() != Object2DType::Camera)
			{
				auto userData = new Culling2DUserData(object);

				auto cObj = culling2d::Object::Create(userData, world);

				cObj->SetFirstSortedKey(world->GetNextFirstSortedKey());
				world->IncNextFirstSortedKey();

				o->SetCullingObject(cObj);


				AddTransformedObject(cObj);
				o->SetAlreadyCullingUpdated(true);


				world->AddObject(cObj);
			}
#endif
		}


	}
Example #3
0
void CBaseEntityList::FinishAddEntity( const entity::EntIndex_t uiIndex, CBaseEntity* pEntity )
{
	m_Entities[ uiIndex ].pEntity = pEntity;

	//Increment the serial number to indicate that a new entity is using the slot.
	++m_Entities[ uiIndex ].serial;

	EHandle handle;

	handle.SetEntHandle( entity::MakeEntHandle( uiIndex, m_Entities[ uiIndex ].serial ) );

	pEntity->SetEntHandle( handle );

	OnAdded( pEntity );
}
Example #4
0
	void Layer3D::RaiseOnAdded()
	{
		OnAdded();
	}