• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetCurrentState函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetCurrentState函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCurrentState函数的具体用法?C++ GetCurrentState怎么用?C++ GetCurrentState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetCurrentState函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: LevelCompletion

void LevelCompletion(void)
{
	WhiteOverlay->Position.x = GetCameraXPosition();
	BlackOverlay->Position.x = GetCameraXPosition();

	if (WhiteOverlay->Alpha > 1)
	{
		//Allow player to upgrade their player if upgrades are available
		if (UpgradeComplete)
		{
			//Continue onto the map
			if (BlackOverlay->Alpha > 1)
			{
				if(GetCurrentState() == GS_Level1)
					SetNextState(GS_Narr1);
				else
					SetNextState(GS_MapLevel);
			}
			else
				BlackOverlay->Alpha += GetDeltaTime();
		}
		else if (!UpgradeComplete)
			UpdateUpgradeScreenObjects();
	}
	else
		WhiteOverlay->Alpha += 2 * GetDeltaTime();
}
开发者ID:Mayple7,项目名称:SausageFox150,代码行数:27,代码来源:Level.c


示例17: switch

DWORD CNetServiceBase::SerHandler(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData)
{
	// Handle the requested control code.
	switch (dwControl){
	case SERVICE_CONTROL_STOP:
	case SERVICE_CONTROL_SHUTDOWN:
		// 关闭服务
		OutputDebugStr(_T("服务端接收到关闭命令\n"));
		SetExitEvent();
		break;
	case SERVICE_CONTROL_INTERROGATE:
		break;
	case SERVICE_CONTROL_PAUSE:
		break;
	case SERVICE_CONTROL_CONTINUE:
		break;
		// invalid control code
	default:
		// update the service status.
		SetCurrentState(GetCurrentState());
		return ERROR_CALL_NOT_IMPLEMENTED;
		break;
	}
	return NO_ERROR;
}
开发者ID:killbug2004,项目名称:lcxl-net-loader,代码行数:25,代码来源:lcxl_net_service.cpp


示例18: GetCurrentState

int StateMachine::Execute(float dt)
{
    DataCache::Instance()->freeGameData();
    // can probably do without this line as pop takes care of it 
    if (m_stateStack.empty()) return -1;

    GetCurrentState()->playMusic();

    if ( GetCurrentState()->Execute(dt) == -1)
    {
        PopState();
    };


    return 0;
}
开发者ID:libeastwood,项目名称:doonlunacy,代码行数:16,代码来源:State.cpp


示例19: SetProbedBedEquation

void Move::SetProbedBedEquation()
{
	float currentPositions[DRIVES+1];
	if(!GetCurrentState(currentPositions))
	{
		platform->Message(HOST_MESSAGE, "Setting bed equation - can't get position!");
		return;
	}

	if(NumberOfProbePoints() >= 3)
	{
		secondDegreeCompensation = (NumberOfProbePoints() == 4);
		if(secondDegreeCompensation)
		{
			/*
			 * Transform to a ruled-surface quadratic.  The corner points for interpolation are indexed:
			 *
			 *   ^  [1]      [2]
			 *   |
			 *   Y
			 *   |
			 *   |  [0]      [3]
			 *      -----X---->
			 *
			 *   These are the scaling factors to apply to x and y coordinates to get them into the
			 *   unit interval [0, 1].
			 */
			xRectangle = 1.0/(xBedProbePoints[3] - xBedProbePoints[0]);
			yRectangle = 1.0/(yBedProbePoints[1] - yBedProbePoints[0]);
			Transform(currentPositions);
			SetPositions(currentPositions);
			return;
		}
	} else
	{
		platform->Message(HOST_MESSAGE, "Attempt to set bed compensation before all probe points have been recorded.");
		return;
	}

	float xkj, ykj, zkj;
	float xlj, ylj, zlj;
	float a, b, c, d;   // Implicit plane equation - what we need to do a proper job

	xkj = xBedProbePoints[1] - xBedProbePoints[0];
	ykj = yBedProbePoints[1] - yBedProbePoints[0];
	zkj = zBedProbePoints[1] - zBedProbePoints[0];
	xlj = xBedProbePoints[2] - xBedProbePoints[0];
	ylj = yBedProbePoints[2] - yBedProbePoints[0];
	zlj = zBedProbePoints[2] - zBedProbePoints[0];
	a = ykj*zlj - zkj*ylj;
	b = zkj*xlj - xkj*zlj;
	c = xkj*ylj - ykj*xlj;
	d = -(xBedProbePoints[1]*a + yBedProbePoints[1]*b + zBedProbePoints[1]*c);
	aX = -a/c;
	aY = -b/c;
	aC = -d/c;
	Transform(currentPositions);
	SetPositions(currentPositions);
}
开发者ID:RepRapMorgan,项目名称:RepRapFirmware,代码行数:59,代码来源:Move.cpp


示例20: GetCurrentState

void CGameStateStack::PopCurrentState()
{
	IEventHandler* state = GetCurrentState();
	if(state)
	{
		state->HandleEvent( EVT_DESTROY, NULL, 0 );
		m_stateStack.RemoveItem(state);
	}
}
开发者ID:FashGek,项目名称:sojourn_engine,代码行数:9,代码来源:GameStateStack.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetCurrentTask函数代码示例发布时间:2022-05-30
下一篇:
C++ GetCurrentPos函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap