예제 #1
0
파일: game.cpp 프로젝트: jcramb/triage
	bool TriageGame::Init()
	{
		// setup OpenGL
		glClearColor(0.1f,0.1f,0.1f, 1.f);
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

		// set up tools
		rng_seed();

		// setup debug objects
		debugTextBuffer.SetFont(g_Font.GetFont());
		debugTextBuffer.SetAnchor(FF_ANCHOR_CENTER);
		debugTextBuffer.SetScale(1);
		fps.SetFont(g_Font.GetFont());
		fps.SetColor(FF_COLOR_YELLOW);
		fps.SetAnchor(FF_ANCHOR_CENTER_RIGHT);

		// initialise level class
		level.Init();

		// initialise state
		state.AddState("menu", StatePtr(new StateMenu()));
		state.AddState("game", StatePtr(new StatePlaying()));
		state.AddState("edit", StatePtr(new TriageEditor()));
		state.SetState("menu");

		return true;
	}
예제 #2
0
파일: Mind.cpp 프로젝트: dolanor/TheDarkMod
void Mind::Think()
{
	// Clear the recyclebin, it might hold a finished state from the last frame
	_recycleBin = StatePtr();

	// greebo: We do not check for NULL pointers in the owner at this point, 
	// as this method is called by the owner itself, it _has_ to exist.
	idAI* owner = _owner.GetEntity();
	assert(owner != NULL);

	if (_stateQueue.empty())
	{
		// We start with the idle state
		PushState(owner->backboneStates[ai::ERelaxed]);
	}

	// At this point, we MUST have a State
	assert(_stateQueue.size() > 0);

	const StatePtr& state = _stateQueue.front();

	// Thinking
	DM_LOG(LC_AI, LT_INFO)LOGSTRING("Mind is thinking... %s\r", owner->name.c_str());


	// Should we switch states (i.e. initialise a new one)?
	if (_switchState)
	{
		// Clear the flag
		_switchState = false;

		// Initialise the state, this will put the Subsystem Tasks in place
		state->Init(owner);
	}

	if (!_switchState)
	{
		// Let the State do its monitoring task
		state->Think(owner);
	}

	// Try to perform the subsystem tasks, skipping inactive subsystems
	// Maximum number of tries is SubsystemCount.
	for (int i = 0; i < static_cast<int>(SubsystemCount); i++)
	{
		// Increase the iterator and wrap around, if necessary
		_subsystemIterator = static_cast<SubsystemId>(
			(static_cast<int>(_subsystemIterator) + 1) % static_cast<int>(SubsystemCount)
		);

		// Subsystems return TRUE when their task was executed
		if (owner->GetSubsystem(_subsystemIterator)->PerformTask())
		{
			// Task performed, break, iterator will be increased next round
			break;
		}
	}
}
예제 #3
0
파일: Engine.cpp 프로젝트: doveiya/isilme
void Engine::ShowLogo()
{
#ifdef _WINDOWS
	Sleep(200);
#endif
    
	mLogo = new LogoState(new hgeSprite(mResourceManager->GetTexture("Data/Textures/Logo.png"),0,0,954, 755));
	mStateManager->Push(StatePtr(mLogo));
	mHGE->System_Start();
    
#ifdef _WINDOWS
	Sleep(200);
#endif
}
StatePtr AgitatedSearchingState::CreateInstance()
{
	return StatePtr(static_cast<State*>(new AgitatedSearchingState));
}
예제 #5
0
void Game::pushState(State *state) {
    if (state != NULL) {
        pushState(StatePtr(state));
    }
}
예제 #6
0
StatePtr PainState::CreateInstance() {
	return StatePtr( new PainState );
}
StatePtr AgitatedSearchingStateLanternBot::CreateInstance()
{
	return StatePtr(new AgitatedSearchingStateLanternBot);
}
예제 #8
0
StatePtr PocketPickedState::CreateInstance()
{
	return StatePtr(new PocketPickedState);
}
예제 #9
0
StatePtr ObservantState::CreateInstance()
{
	return StatePtr(new ObservantState);
}
예제 #10
0
StatePtr FleeDoneState::CreateInstance()
{
	return StatePtr(new FleeDoneState);
}
예제 #11
0
StatePtr KnockedOutState::CreateInstance()
{
	return StatePtr(new KnockedOutState);
}
예제 #12
0
StatePtr UnreachableTargetState::CreateInstance()
{
	return StatePtr(new UnreachableTargetState);
}
예제 #13
0
StatePtr HitByMoveableState::CreateInstance()
{
	return StatePtr(new HitByMoveableState);
}
예제 #14
0
StatePtr IdleSleepState::CreateInstance()
{
	return StatePtr(new IdleSleepState);
}
StatePtr TakeCoverState::CreateInstance()
{
	return StatePtr(new TakeCoverState);
}
예제 #16
0
StatePtr CombatState::CreateInstance()
{
	return StatePtr(new CombatState);
}
예제 #17
0
StatePtr LostTrackOfEnemyState::CreateInstance()
{
	return StatePtr(new LostTrackOfEnemyState);
}
예제 #18
0
StatePtr ExamineRopeState::CreateInstance()
{
	return StatePtr(new ExamineRopeState);
}
StatePtr SearchingState::CreateInstance() {
	return StatePtr( new SearchingState );
}
예제 #20
0
 StateManagerSystem::StateManagerSystem() : m_ActiveState(std::move(StatePtr(nullptr))), m_Initialized(false)
 {}