void MainMenuGameState::ProcessInput(double deltaSeconds){ UNUSED(deltaSeconds); IF_INPUT_SYSTEM_EXISTS{ if (INPUT_IS_KEY_RELEASED(KEY_ENTER) || INPUT_IS_KEY_RELEASED(KEY_SPACEBAR)){ SetCurrentGameState("Play"); } } }
void APGGameMode::Tick(float DeltaTime) { Super::Tick(DeltaTime); APGCharacter* MyCharacter{ Cast<APGCharacter>(UGameplayStatics::GetPlayerPawn(this, 0)) }; if (MyCharacter) { if (MyCharacter->GetCurrentPower() > PowerToWin) { SetCurrentGameState(EPGPlayState::EWon); } else if (MyCharacter->GetCurrentPower() > 0) { MyCharacter->UpdatePower(-DeltaTime * DecayRate * MyCharacter->GetInitialPower()); } else { SetCurrentGameState(EPGPlayState::EGameOver); } } }
void AApplication::StartGame(void) { Core::GetInstance()->LoadProfile(); setupResources(Core::GetInstance()->GetLevelPath()); ResourceGroupManager::getSingleton().initialiseResourceGroup(LEVEL_RESOURCE_GROUP); ResourceGroupManager::getSingleton().loadResourceGroup(LEVEL_RESOURCE_GROUP, true, true); //loadResources(); //MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName("Sky"); //mat->setFog(true, Ogre::FOG_LINEAR, Ogre::ColourValue::White, 0.001, 0, 100); //GUISystem::GetInstance()->GetRadar()->Load(); //MeshPtr m = MeshManager::getSingleton().load("player.mesh", LEVEL_RESOURCE_GROUP); //unsigned short src=0, dest=0; ////if (!m->suggestTangentVectorBuildParams(VES_TANGENT, src, dest)) //{ // m->suggestTangentVectorBuildParams(VES_TANGENT, src, dest); // m->buildTangentVectors(VES_TANGENT, src, dest); //} Core::GetInstance()->CreatePlayer(); ScriptManager::GetInstance()->Init(); createScene(); //mWindow->getViewport(0)->setBackgroundColour(ColourValue(1,1,1)); //createCamera(); //mSceneMgr->setFog(Ogre::FOG_LINEAR, Ogre::ColourValue::White, 0.001f, 5000.f, 10000.f); LinkCamera(Core::GetInstance()->GetPlayer()); SetCurrentCamera(PlayersCamera->GetOgreCamera()); //createViewports(); //InitGui(); //createFrameListener(); //SwitchListener(); SetCurrentGameState(AApplication::GS_GAME); CommonDeclarations::PlayIntroMusic(false); Core::GetInstance()->Start(); }
void APGGameMode::BeginPlay() { Super::BeginPlay(); SetCurrentGameState(EPGPlayState::EPlaying); // Set up victory conditions APGCharacter* PlayerCharacter = Cast<APGCharacter>(UGameplayStatics::GetPlayerCharacter(this, 0)); if (PlayerCharacter) { PowerToWin = PowerToWinFactor * PlayerCharacter->GetInitialPower(); } // Set up the HUD if (HUDWidgetClass != nullptr) { HUDWidget = CreateWidget<UUserWidget>(GetWorld(), HUDWidgetClass); if (HUDWidget != nullptr) { HUDWidget->AddToViewport(); } } }
/** Sets up the application - returns false if the user chooses to abandon configuration. */ bool AApplication::setup(void) { mRoot = new Root(); setupResources("media/common/"); bool carryOn = configure(); if (!carryOn) return false; chooseSceneManager(); // Set default mipmap level (NB some APIs ignore this) TextureManager::getSingleton().setDefaultNumMipmaps(5); ResourceGroupManager::getSingleton().initialiseResourceGroup("Bootstrap"); ResourceGroupManager::getSingleton().initialiseResourceGroup(GUI_RESOURCE_GROUP); ResourceGroupManager::getSingleton().initialiseResourceGroup("General"); ScriptsCamera = mSceneMgr->createCamera("ScriptsCamera"); ScriptsCamera->setNearClipDistance(5); ScriptsCamera->setFarClipDistance(0); CombatCamera = mSceneMgr->createCamera("CombatCamera"); CombatCamera->setNearClipDistance(5); CombatCamera->setFarClipDistance(0); Ogre::SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); node->attachObject(ScriptsCamera); createCamera(); createViewports(); Core *Instance = Core::GetInstance(); Instance->SetSceneManager(mSceneMgr); Instance->SetApplication(this); InitGui(); if (0!=Instance->Init()) return false; //CurrentListener = GUISystem::GetInstance(); //mRoot->addFrameListener(CurrentListener); /*MaterialPtr fade = Ogre::MaterialManager::getSingleton().create("FadeMaterial", "General"); fade->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA);*/ createFrameListener(); AACommandsFrameListener *commands_listener = AACommandsFrameListener::GetInstance(); commands_listener->Init(mWindow); commands_listener->SetCurrentHandler(Instance); mRoot->addFrameListener(commands_listener); EditorFrameListener *editor_listener = EditorFrameListener::GetInstance(); editor_listener->Init(mWindow); CombatFrameListener::GetInstance()->Init(mWindow); ComixFrameListener::GetInstance()->Init(mWindow); //SetCurrentGameState(AApplication::GS_STUDIOINTRO); SetCurrentGameState(AApplication::GS_COMIX); ComixFrameHandler *handler = new ComixFrameHandler(); TiXmlElement *xml = ObjectsLibrary::GetParsed("logo_intro.xml"); handler->Parse(xml); delete xml; ComixFrameListener *listener = ComixFrameListener::GetInstance(); listener->SetCurrentHandler(handler); CommonDeclarations::PlayIntroMusic(true); //handler->Show(0); //handler->SetActive(0, true); //handler->Show(1); //handler->SetActive(1, true); //SetCurrentGameState(AApplication::GS_GUI); //GUISystem::GetInstance()->GetIntroMenu()->Show(); //GUISystem::GetInstance()->Show(); return true; }