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


C++ SwitchState函数代码示例

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


在下文中一共展示了SwitchState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: VERIFY

void CElevatorState::UpdateStNone()
{
	VERIFY(m_ladder&&m_character);
	Fvector d;m_ladder->DToPlain(m_character,d);
	if(m_ladder->BeforeLadder(m_character)&&m_ladder->InTouch(m_character)&&dXZDotNormalized(d,m_character->CamDir())>look_angle_cosine)
	{

		if(ClimbDirection()>0.f)
		{
			SwitchState(clbClimbingUp);
		}
		else
		{
			SwitchState(clbClimbingDown);
		}
	}
	else
	{
		Fvector temp;
		float d_to_lower=m_ladder->DDLowerP(m_character,temp),d_to_upper=m_ladder->DDUpperP(m_character,temp);
		if(d_to_lower<d_to_upper)
		{
			if(getting_on_dist+m_character->FootRadius() > d_to_lower)
															SwitchState(clbNearDown);
		}
		else
		{
			if(getting_on_dist+m_character->FootRadius() > d_to_upper)
															SwitchState(clbNearUp);
		}
	}
}
开发者ID:2asoft,项目名称:xray,代码行数:32,代码来源:ElevatorState.cpp

示例2: SwitchState

bool CWeaponMagazined::TryReload()
{
	if (m_pCurrentInventory)
	{
		if (TryToGetAmmo(m_ammoType) || unlimited_ammo() || (IsMisfire() && iAmmoElapsed))
		{
			m_bPending	= true;
			SwitchState(eReload);
			return true;
		}

		for (u32 i = 0; i < m_ammoTypes.size(); ++i)
		{
			if (TryToGetAmmo(i))
			{
				m_ammoType	= i;
				m_bPending	= true;
				SwitchState(eReload);
				return true;
			}
		}
	}

	SwitchState(eIdle);

	return false;
}
开发者ID:Karlan88,项目名称:xray,代码行数:27,代码来源:WeaponMagazined.cpp

示例3: switch

void CArtefact::OnAnimationEnd(u32 state)
{
	switch (state)
	{
	case eHiding:
		{
			SwitchState(eHidden);
		}break;
	case eShowing:
		{
			SwitchState(eIdle);
		}break;
	case eActivating:
		{
			if(Local())
			{
				SwitchState		(eHiding);
				NET_Packet		P;
				u_EventGen		(P, GEG_PLAYER_ACTIVATEARTEFACT, H_Parent()->ID());
				P.w_u16			(ID());
				u_EventSend		(P);	
			}
		}break;
	};
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:25,代码来源:Artefact.cpp

示例4: switch

void CArtefact::OnAnimationEnd		(u32 state)
{
	switch (state)
	{
	case eHiding:
		{
			SwitchState(eHidden);
//.			if(m_pInventory->GetNextActiveSlot()!=NO_ACTIVE_SLOT)
//.				m_pInventory->Activate(m_pInventory->GetPrevActiveSlot());
		}break;
	case eShowing:
		{
			SwitchState(eIdle);
		}break;
	case eActivating:
		{
			if(Local()){
				SwitchState		(eHiding);
				NET_Packet		P;
				u_EventGen		(P, GEG_PLAYER_ACTIVATEARTEFACT, H_Parent()->ID());
				P.w_u16			(ID());
				u_EventSend		(P);	
			}
		}break;
	};
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:26,代码来源:Artifact.cpp

示例5: switch

void CWeaponMagazined::OnAnimationEnd(u32 state)
{
	switch (state)
	{
	case eReload:	ReloadMagazine();	SwitchState(eIdle);	break;	// End of reload animation
	case eHiding:	SwitchState(eHidden);   break;	// End of Hide
	case eShowing:	SwitchState(eIdle);		break;	// End of Show
	case eIdle:		switch2_Idle();			break;  // Keep showing idle
	}
}
开发者ID:Karlan88,项目名称:xray,代码行数:10,代码来源:WeaponMagazined.cpp

示例6: SwitchState

void CArtefact::OnHiddenItem ()
{
	if(IsGameTypeSingle())
		SwitchState(eHiding);
	else
		SwitchState(eHidden);

	inherited::OnHiddenItem		();
	SetState					(eHidden);
	SetNextState				(eHidden);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:11,代码来源:Artefact.cpp

示例7: SwitchState

void CWeapon::OnHiddenItem ()
{
	m_BriefInfo_CalcFrame = 0;

	if(IsGameTypeSingle())
		SwitchState(eHiding);
	else
		SwitchState(eHidden);

	OnZoomOut();
	inherited::OnHiddenItem		();

	m_set_next_ammoType_on_reload = undefined_ammo_type;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:14,代码来源:Weapon.cpp

示例8: SwitchState

void ButtonWidget::OnMouseUnfocusEvent(MouseEvent me)
{
	if (m_currentState == UI_STATE_DISABLED)
		return;

	if (me.m_mouseEventType == LEFT_BUTTON_UP) { // Not on the button, released 
		SwitchState(UI_STATE_DEFAULT);
	}

	if (me.m_mouseEventType == MOVED && m_currentState != UI_STATE_PRESSED) { //Not on the button, moved
		SwitchState(UI_STATE_DEFAULT);
	}

	WidgetBase::OnMouseUnfocusEvent(me);
}
开发者ID:2bitdreamer,项目名称:SD6_Engine,代码行数:15,代码来源:ButtonWidget.cpp

示例9: switch

void CWeaponKnife::OnAnimationEnd(u32 state)
{
	switch (state)
	{
	case eHiding:	SwitchState(eHidden);	break;
	
	case eFire: 
	case eFire2: 	SwitchState(eIdle);		break;

	case eShowing:
	case eIdle:		SwitchState(eIdle);		break;	

	default:		inherited::OnAnimationEnd(state);
	}
}
开发者ID:2asoft,项目名称:xray,代码行数:15,代码来源:WeaponKnife.cpp

示例10: SwitchState

	//-------------------------------------------------------------------
	void StateManager::Update (Engine& engine, uint millisecond)
	{
		if( m_isJustSwitch )
		{
			m_isJustSwitch = false;
			millisecond = 17;
		}
		if( m_isLoadResouce )
		{
			m_isLoadResouce = false;
			m_isJustSwitch = true;
			m_lStateList.begin()->m_pStatePtr->LoadResource(engine);
			m_lStateList.begin()->m_pStatePtr->OnEnter(engine, m_ePreviousState );
			m_isShowLoading = false;
			m_pLoading->SetShow(false);
			engine.GetActionManager()->SetResponse(true);//开始保存按键buffer
		}
		if ( !m_lStateList.empty() )
		{
			m_lStateList.begin()->m_pStatePtr->Update(*this,engine, millisecond);
		}
		if( true == m_isSwitchState)
		{
			SwitchState(engine);
		}
	}
开发者ID:ServerGame,项目名称:Bohge_Engine,代码行数:27,代码来源:StateManager.cpp

示例11: SwitchState

void CElevatorState::Deactivate()
{
	SwitchState(clbNoLadder);
	m_state=clbNoLadder;
	m_ladder=NULL;
	m_character=NULL;
}
开发者ID:2asoft,项目名称:xray,代码行数:7,代码来源:ElevatorState.cpp

示例12: SwitchState

void GameApplication::OnStartLevel(std::shared_ptr<IEventData> eventData)
{
    std::shared_ptr<Event_StartLevel> pEvent = std::dynamic_pointer_cast<Event_StartLevel>(eventData);
    if (pEvent)
    {
        // remove current list of actors
        for (auto it = m_Actors.begin(); it != m_Actors.end(); ++it)
        {
            m_Physics->RemoveActor(it->second->GetID());
            m_Scene->RemoveChild(it->second->GetID());
            it->second->Destroy();
        }
        m_Actors.clear();
        m_ImportantActors.clear();
        m_Physics->RemoveQueuedItems();
        m_Physics->Reset();
        m_Audio->StopAll();
        m_Scene->Clear();
        m_EventManager->Clear();
        ResourceManager::GetInstance()->LoadLevel(m_Scene, pEvent->GetLevelPath().c_str());
        m_Scene->Initialize();

        m_GameTime    = 0.0f;
        m_PhysicsTime = 0.0f;

        SwitchState(GameState::GAME_INTRO);
    }
}
开发者ID:JoeyDeVries,项目名称:Lucid,代码行数:28,代码来源:GameApplication.cpp

示例13: switch

bool CWeaponMagazinedWGrenade::Action(s32 cmd, u32 flags) 
{
	if(m_bGrenadeMode && cmd==kWPN_FIRE)
	{
		if(IsPending())		
			return				false;

		if(flags&CMD_START)
		{
			if(iAmmoElapsed)
				LaunchGrenade		();
			else
				Reload				();

			if(GetState() == eIdle) 
				OnEmptyClick			();
		}
		return					true;
	}
	if(inherited::Action(cmd, flags))
		return true;
	
	switch(cmd) 
	{
	case kWPN_FUNC: 
		{
            if(flags&CMD_START && !IsPending()) 
				SwitchState(eSwitch);
			return true;
		}
	}
	return false;
}
开发者ID:2asoft,项目名称:xray,代码行数:33,代码来源:WeaponMagazinedWGrenade.cpp

示例14: OnActiveItem

void CArtefact::OnActiveItem ()
{
	SwitchState					(eShowing);
	inherited::OnActiveItem		();
	SetState					(eIdle);
	SetNextState				(eIdle);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:7,代码来源:Artefact.cpp

示例15: switch

void CGrenade::OnAnimationEnd(u32 state) 
{
	switch(state)
	{
	case eThrowEnd: SwitchState(eHidden);	break;
	default : inherited::OnAnimationEnd(state);
	}
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:8,代码来源:Grenade.cpp


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