当前位置: 首页>>代码示例>>C++>>正文


C++ GetCurrentState函数代码示例

本文整理汇总了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);
        }
      }
开发者ID:ASchurman,项目名称:Dissent,代码行数:38,代码来源:RoundStateMachine.hpp

示例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;
}
开发者ID:Fiocitrine,项目名称:darkstar,代码行数:29,代码来源:ai_container.cpp

示例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;
}
开发者ID:TKayyy,项目名称:darkstar,代码行数:25,代码来源:ai_container.cpp

示例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();
}
开发者ID:FRCTeam1967,项目名称:FRCTeam1967,代码行数:9,代码来源:JankyAutoSequencer.cpp

示例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;
}
开发者ID:richelbilderbeek,项目名称:RibiClasses,代码行数:11,代码来源:standardwhitenoisesystem.cpp

示例6:

mitk::ProcessEventMode mitk::DataInteractor::GetMode() const
{
  if (GetCurrentState()->GetMode() == "PREFER_INPUT")
  {
    return PREFERINPUT;
  }
  if (GetCurrentState()->GetMode() == "GRAB_INPUT")
  {
    return GRABINPUT;
  }
  return REGULAR;
}
开发者ID:0r,项目名称:MITK,代码行数:12,代码来源:mitkDataInteractor.cpp

示例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);
	}
}
开发者ID:Serebriakov,项目名称:premake,代码行数:26,代码来源:player.cpp

示例8: runState

void VtolLandFSM::Update()
{
    runState();
    if (GetCurrentState() != PFFSM_STATE_INACTIVE) {
        runAlways();
    }
}
开发者ID:MAVProxyUser,项目名称:NinjaPilot-15.02.ninja,代码行数:7,代码来源:vtollandfsm.cpp

示例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;
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:27,代码来源:nsComposerCommands.cpp

示例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];

    }
}
开发者ID:zhiltsov-max,项目名称:tower-defense,代码行数:26,代码来源:game_gui_main.cpp

示例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;
}
开发者ID:151706061,项目名称:MITK,代码行数:7,代码来源:berryHandlerService.cpp

示例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();
}
开发者ID:TKayyy,项目名称:darkstar,代码行数:35,代码来源:ai_container.cpp

示例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);
}
开发者ID:RepRapMorgan,项目名称:RepRapFirmware,代码行数:26,代码来源:Move.cpp

示例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;
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:28,代码来源:nsComposerCommands.cpp

示例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
}
开发者ID:Mayple7,项目名称:SausageFox150,代码行数:34,代码来源:PauseMenu.c


注:本文中的GetCurrentState函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。