/********************************************************************************
Run
********************************************************************************/
void Scene_MapEditor::Run_Stage1()
{
	//Call parent--------------------------------------//
	Scene::Run_Stage1();

	UpdatePlayerInput();
}
//-----------------------------------------------------------------------------------
void TheGame::UpdatePlaying(float deltaSeconds)
{
    UNUSED(deltaSeconds);
    UpdatePlayerInput();
    bool isSimulating = true;
    bool advanceTime = true;
    while (isSimulating)
    {
        auto agentIter = m_agentsWaitingForTurn.begin();
        Agent* agent = agentIter->second;

        if (agentIter->first > simulationClock)
        {
            break;
        }
        if (!agent->IsReadyToUpdate())
        {
            advanceTime = false;
            break; //Player is not ready to update? just stop kek
        }
        m_agentsWaitingForTurn.erase(agentIter);
        float duration = 1.0f;
        if (agent->IsAlive()) //Make sure you're alive before update
            duration = agent->Update(deltaSeconds); //UpdateSimulation
        if (agent->IsAlive()) //Make sure you didn't die in the update
            m_agentsWaitingForTurn.insert(TurnOrderMapPair(simulationClock + duration, agent));
    }

    if (advanceTime)
        simulationClock += simulationDelta;
    CleanUpDeadEntities();

    if (InputSystem::instance->WasKeyJustPressed(InputSystem::ExtraKeys::ESC))
    {
        SetGameState(GameState::PAUSED);
    }
}
Beispiel #3
0
void GameManager::PlayGame() 
{
	while (!doExit) //Main Game Loop
	{	
		RunGameOverCheck();

		UpdateGameTimers();

		UpdatePlayerInput();

		UpdateEnemySpawner();

		UpdateEnemies();

		UpdatePlayer();

		UpdateBullets();

		RunCollisionCheck();

		Render(); //Render everyting
	}
	QuitGame();
}