本文整理汇总了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);
}
}
}
示例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;
}
示例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;
};
}
示例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;
};
}
示例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
}
}
示例6: SwitchState
void CArtefact::OnHiddenItem ()
{
if(IsGameTypeSingle())
SwitchState(eHiding);
else
SwitchState(eHidden);
inherited::OnHiddenItem ();
SetState (eHidden);
SetNextState (eHidden);
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例11: SwitchState
void CElevatorState::Deactivate()
{
SwitchState(clbNoLadder);
m_state=clbNoLadder;
m_ladder=NULL;
m_character=NULL;
}
示例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);
}
}
示例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;
}
示例14: OnActiveItem
void CArtefact::OnActiveItem ()
{
SwitchState (eShowing);
inherited::OnActiveItem ();
SetState (eIdle);
SetNextState (eIdle);
}
示例15: switch
void CGrenade::OnAnimationEnd(u32 state)
{
switch(state)
{
case eThrowEnd: SwitchState(eHidden); break;
default : inherited::OnAnimationEnd(state);
}
}