本文整理汇总了C++中GetCurrentState函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCurrentState函数的具体用法?C++ GetCurrentState怎么用?C++ GetCurrentState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCurrentState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StateComplete
/**
* Called when the current state has finished and is ready to transition
* into the next state
*/
void StateComplete(int state = -1)
{
_round->BeforeStateTransition();
Log tmp = _next_state_log;
_next_state_log = Log();
if((_cycle_state == GetCurrentState()->GetState()) && (state == -1)) {
qDebug() << "In" << _round->ToString() << "ending phase";
if(!_round->CycleComplete()) {
return;
}
_log = Log();
IncrementPhase();
}
if(state == -1) {
qDebug() << "In" << _round->ToString() << "ending:" <<
StateToString(GetCurrentState()->GetState()) <<
"starting:" << StateToString(GetNextState()->GetState());
_current_sm_state = GetNextState();
} else {
qDebug() << "In" << _round->ToString() << "ending:" <<
StateToString(GetCurrentState()->GetState()) <<
"starting:" << StateToString(_states[state]->GetState());
_current_sm_state = _states[state];
}
(_round->*GetCurrentState()->GetTransitionCallback())();
for(int idx = 0; idx < tmp.Count(); idx++) {
QPair<QByteArray, Id> entry = tmp.At(idx);
ProcessData(entry.second, entry.first);
}
}
示例2: ChangeTarget
bool CAIContainer::Internal_Engage(uint16 targetid)
{
//#TODO: pet engage/disengage
auto entity {dynamic_cast<CBattleEntity*>(PEntity)};
if (entity && entity->PAI->IsEngaged())
{
if (entity->GetBattleTargetID() != targetid)
{
ChangeTarget(targetid);
return true;
}
return false;
}
//#TODO: use valid target stuff from spell
if (entity)
{
//#TODO: remove m_battleTarget if possible (need to check disengage)
if (CanChangeState() || (GetCurrentState() && GetCurrentState()->IsCompleted()))
{
if (ForceChangeState<CAttackState>(entity, targetid))
{
entity->OnEngage(*static_cast<CAttackState*>(m_stateStack.top().get()));
}
}
return true;
}
return false;
}
示例3: ChangeTarget
bool CAIContainer::Internal_Engage(uint16 targetid)
{
//#TODO: pet engage/disengage
auto PTarget {dynamic_cast<CBattleEntity*>(PEntity->GetEntity(targetid))};
auto entity {dynamic_cast<CBattleEntity*>(PEntity)};
if (entity && entity->PAI->IsEngaged() && entity->GetBattleTargetID() != targetid)
{
ChangeTarget(targetid);
return true;
}
//#TODO: use valid target stuff from spell
if (entity && PTarget && !PTarget->isDead())
{
//#TODO: remove m_battleTarget if possible (need to check disengage)
entity->SetBattleTargetID(targetid);
entity->SetBattleStartTime(server_clock::now());
if (CanChangeState() || (GetCurrentState() && GetCurrentState()->IsCompleted()))
{
ForceChangeState<CAttackState>(entity, targetid);
}
return true;
}
return false;
}
示例4: printf
void JankyAutoSequencer::EndSequence(){
printf("Current Entry: %s \n", names[GetCurrentState()]);
frc::SmartDashboard::PutString("Current Entry", names[GetCurrentState()]);
if(entries[GetCurrentState()]){
entries[GetCurrentState()]->Abort();
printf("Aborted Entry: %s \n", names[GetCurrentState()]);
}
Pause();
}
示例5: GetCurrentState
boost::numeric::ublas::vector<double> ribi::kalman::StandardWhiteNoiseSystem::Measure() const noexcept
{
const auto sz = GetCurrentState().size();
assert(GetCurrentState().size() == m_parameters->GetMeasurementNoise().size());
boost::numeric::ublas::vector<double> measured(sz);
for (std::size_t i = 0; i!=sz; ++i)
{
measured(i) = GetRandomNormal(GetCurrentState()(i),m_parameters->GetMeasurementNoise()(i));
}
return measured;
}
示例6:
mitk::ProcessEventMode mitk::DataInteractor::GetMode() const
{
if (GetCurrentState()->GetMode() == "PREFER_INPUT")
{
return PREFERINPUT;
}
if (GetCurrentState()->GetMode() == "GRAB_INPUT")
{
return GRABINPUT;
}
return REGULAR;
}
示例7: switch
void Player::Update()
{
// animate sprite
m_Sprite->Animate();
// move the sprite with the hitbox
glm::vec2 pos;
pos.x = m_Hitbox.GetCenterPosition().x - (m_Sprite->GetSize().x / 2.f);
pos.y = m_Hitbox.m_Position.y + m_Hitbox.m_Size.y - m_Sprite->GetSize().y;
m_Sprite->SetPosition(pos);
// update the weapon...
if( IsAttacking() )
{
Weapon::WEAPON_STATE w_state;
switch( GetCurrentState() )
{
case ATTACKING : w_state = Weapon::ATTACKING; break;
case ATTACKING_UP : w_state = Weapon::ATTACKING_UP; break;
case ATTACKING_DOWN : w_state = Weapon::ATTACKING_DOWN; break;
}
m_Weapons[m_CurrentWeaponIndex]->SetState(w_state);
m_Weapons[m_CurrentWeaponIndex]->UseFrame(m_Sprite);
}
}
示例8: runState
void VtolLandFSM::Update()
{
runState();
if (GetCurrentState() != PFFSM_STATE_INACTIVE) {
runAlways();
}
}
示例9: do_QueryInterface
nsresult
nsListCommand::ToggleState(nsIEditor *aEditor, const char* aTagName)
{
nsCOMPtr<nsIHTMLEditor> editor = do_QueryInterface(aEditor);
NS_ENSURE_TRUE(editor, NS_NOINTERFACE);
bool inList;
// Need to use mTagName????
nsresult rv;
nsCOMPtr<nsICommandParams> params =
do_CreateInstance(NS_COMMAND_PARAMS_CONTRACTID,&rv);
if (NS_FAILED(rv) || !params)
return rv;
rv = GetCurrentState(aEditor, mTagName, params);
rv = params->GetBooleanValue(STATE_ALL,&inList);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString listType; listType.AssignWithConversion(mTagName);
if (inList)
rv = editor->RemoveList(listType);
else
{
rv = editor->MakeOrChangeList(listType, false, EmptyString());
}
return rv;
}
示例10: updateStatistics
BEGIN_GAME_GUI
void updateStatistics(const TGameStatistics& statistics, const TLevel& level) {
string header = "Game over!";
if ((GetCurrentState() == AppState::Level) && (level.GetProgress().isStageCompleted())) {
header = "Stage clear!";
}
statisticsWindow->SetTitle(header);
std::array<TextString> statisticsOutput = {
"Score: " + level.GetProgress().GetPoints(),
"Buildings: " + statistics.GetMetric(Metric.buildingsCreated).as<int>(),
"Credis spent: " + statistics.GetMetric(Metric.creditsSpent).as<int>(),
"Credits earned: " + statistics.GetMetric(Metric.creditsEarned).as<int>(),
"Mobs: " + (statistics.GetMetric(Metric.mobsKilled).as<int>() + gameStatistics.GetMetric(Metric.mobsPassed).as<int>()),
" passed: " + statistics.GetMetric(Metric.mobsPassed).as<int>(),
" killed: " + statistics.GetMetric(Metric.mobsKilled).as<int>(),
"Press any key to continue..."
};
string statisticsText = "Results:";
for (size_t i = 0, iend = statisticsOutput.size(); i != iend; ++i) {
statisticsText += std::endl + statisticsOutput[i];
}
}
示例11: event
SmartPointer<const ExecutionEvent> HandlerService::CreateExecutionEvent(const SmartPointer<const Command>& command,
const SmartPointer<const UIElement>& trigger)
{
ExecutionEvent::Pointer event(new ExecutionEvent(command, ExecutionEvent::ParameterMap(), trigger,
Object::Pointer(GetCurrentState())));
return event;
}
示例12: while
void CAIContainer::Tick(time_point _tick)
{
m_PrevTick = m_Tick;
m_Tick = _tick;
PEntity->Tick(_tick);
//#TODO: check this in the controller instead maybe? (might not want to check every tick) - same for pathfind
ActionQueue.checkAction(_tick);
// check pathfinding
if (!Controller && CanFollowPath())
{
PathFind->FollowPath();
if (PathFind->OnPoint()) {
luautils::OnPath(PEntity);
}
}
if (Controller && Controller->canUpdate)
{
Controller->Tick(_tick);
}
CState* top = nullptr;
while (!m_stateStack.empty() && (top = m_stateStack.top().get())->DoUpdate(_tick))
{
if (top == GetCurrentState())
{
m_stateStack.top()->Cleanup(_tick);
m_stateStack.pop();
}
}
PEntity->UpdateEntity();
}
示例13: SetAxisCompensation
void Move::SetAxisCompensation(int8_t axis, float tangent)
{
float currentPositions[DRIVES+1];
if(!GetCurrentState(currentPositions))
{
platform->Message(HOST_MESSAGE, "Setting bed equation - can't get position!");
return;
}
switch(axis)
{
case X_AXIS:
tanXY = tangent;
break;
case Y_AXIS:
tanYZ = tangent;
break;
case Z_AXIS:
tanXZ = tangent;
break;
default:
platform->Message(HOST_MESSAGE, "SetAxisCompensation: dud axis.\n");
}
Transform(currentPositions);
SetPositions(currentPositions);
}
示例14: do_QueryInterface
nsresult
nsListCommand::ToggleState(nsIEditor *aEditor)
{
nsCOMPtr<nsIHTMLEditor> editor = do_QueryInterface(aEditor);
NS_ENSURE_TRUE(editor, NS_NOINTERFACE);
nsresult rv;
nsCOMPtr<nsICommandParams> params =
do_CreateInstance(NS_COMMAND_PARAMS_CONTRACTID,&rv);
if (NS_FAILED(rv) || !params)
return rv;
rv = GetCurrentState(aEditor, params);
NS_ENSURE_SUCCESS(rv, rv);
bool inList;
rv = params->GetBooleanValue(STATE_ALL,&inList);
NS_ENSURE_SUCCESS(rv, rv);
nsDependentAtomString listType(mTagName);
if (inList) {
rv = editor->RemoveList(listType);
} else {
rv = editor->MakeOrChangeList(listType, false, EmptyString());
}
return rv;
}
示例15: FreePause
void FreePause(void)
{
FreeSprite(PauseText);
FreeSprite(SFXSliderGuide);
FreeSprite(BGMSliderGuide);
FreeSprite(SFXSliderBack);
FreeSprite(BGMSliderBack);
FreeSprite(PauseBackground);
FreeSprite(EnableCheats);
FreeSprite(CheckMark);
FreeButton(CheatsButton);
FreeSprite(EnableLookAt);
FreeSprite(LookAtCheckMark);
FreeButton(LookAtButton);
FreeButton(SFXSlider);
FreeButton(BGMSlider);
FreeButton(ResumeButton);
FreeButton(MainMenuButton);
if(GetCurrentState() != GS_MapLevel)
FreeButton(RestartButton);
FreeText(SFXText);
FreeText(BGMText);
FreeText(SFXLabel);
FreeText(BGMLabel);
FreeMyAlloc(volumestring);
ReleaseSound(BackgroundSnd.Sound); //Keep this here otherwise sound exists foreverrrrrrrr
}