VisBaseEntity_cl* MyGameManager::SpawnPlayer(const VString& prefabName, hkvVec3 const& position, hkvVec3 const& orientation) { VisBaseEntity_cl* playerEntity = CreateEntityFromPrefab(prefabName, position, orientation); playerEntity->InitFunction(); if(playerEntity) { PlayerComponent *const playerController = static_cast<PlayerComponent*> (playerEntity->Components().GetComponentOfBaseType(V_RUNTIME_CLASS(PlayerComponent))); //VASSERT(playerController); if(playerController) { spGUIContext = new VGUIMainContext(NULL); // Create a GUI context mDialog = new PlayerDialog(playerController); mDialog->InitDialog(spGUIContext, NULL, NULL); spGUIContext->ShowDialog(mDialog); spGUIContext->SetActivate(true); } m_playerEntity = playerEntity->GetWeakReference(); //Vision::Message.Add(1, "Spawn"); } return playerEntity; }
EngineInstancePathCamera::EngineInstancePathCamera() { VisBaseEntity_cl *pEntity = Vision::Game.CreateEntity("PathCameraEntity",hkvVec3(0,0,0)); Debug::Assert(pEntity!=nullptr,"Could not create Cloth entity!"); // reference the entity with a weak pointer. This will make sure that we correctly get a null pointer // if the entity gets deleted in the engine m_pEntityWP = new VWeakPtr<VisBaseEntity_cl>(pEntity->GetWeakReference()); m_pSpriteTex = Vision::TextureManager.Load2DTexture("textures\\videoCamera.dds",VTM_FLAG_DEFAULT_NON_MIPMAPPED); m_pSpriteTex->AddRef(); }