示例#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
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);
}
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);
}
StatePtr LostTrackOfEnemyState::CreateInstance()
{
	return StatePtr(new LostTrackOfEnemyState);
}
示例#18
0
StatePtr ExamineRopeState::CreateInstance()
{
	return StatePtr(new ExamineRopeState);
}
StatePtr SearchingState::CreateInstance() {
	return StatePtr( new SearchingState );
}
 StateManagerSystem::StateManagerSystem() : m_ActiveState(std::move(StatePtr(nullptr))), m_Initialized(false)
 {}