本文整理汇总了C++中KX_GameObject::SetPlayMode方法的典型用法代码示例。如果您正苦于以下问题:C++ KX_GameObject::SetPlayMode方法的具体用法?C++ KX_GameObject::SetPlayMode怎么用?C++ KX_GameObject::SetPlayMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KX_GameObject
的用法示例。
在下文中一共展示了KX_GameObject::SetPlayMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
//.........这里部分代码省略.........
if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE))
m_localtime = obj->GetActionFrame(m_layer);
if (m_flag & ACT_FLAG_ATTEMPT_PLAY)
SetLocalTime(curtime);
else
ResetStartTime(curtime);
// Handle a frame property if it's defined
if ((m_flag & ACT_FLAG_ACTIVE) && m_framepropname[0] != 0)
{
CValue* oldprop = obj->GetProperty(m_framepropname);
CValue* newval = new CFloatValue(obj->GetActionFrame(m_layer));
if (oldprop)
oldprop->SetValue(newval);
else
obj->SetProperty(m_framepropname, newval);
newval->Release();
}
// Handle a finished animation
if ((m_flag & ACT_FLAG_PLAY_END) && (m_flag & ACT_FLAG_ACTIVE) && obj->IsActionDone(m_layer))
{
m_flag &= ~ACT_FLAG_ACTIVE;
m_flag &= ~ACT_FLAG_ATTEMPT_PLAY;
if (m_playtype == ACT_ACTION_PINGPONG)
m_flag ^= ACT_FLAG_REVERSE;
return false;
}
// If a different action is playing, we've been overruled and are no longer active
if (obj->GetCurrentAction(m_layer) != m_action && !obj->IsActionDone(m_layer))
m_flag &= ~ACT_FLAG_ACTIVE;
if (bPositiveEvent || (m_flag & ACT_FLAG_ATTEMPT_PLAY && !(m_flag & ACT_FLAG_ACTIVE)))
{
if (bPositiveEvent && m_playtype == ACT_ACTION_PLAY)
{
if (obj->IsActionDone(m_layer))
m_localtime = start;
ResetStartTime(curtime);
}
if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, playtype, m_layer_weight, m_ipo_flags))
{
m_flag |= ACT_FLAG_ACTIVE;
if (bUseContinue)
obj->SetActionFrame(m_layer, m_localtime);
if (m_playtype == ACT_ACTION_PLAY || m_playtype == ACT_ACTION_PINGPONG)
m_flag |= ACT_FLAG_PLAY_END;
else
m_flag &= ~ACT_FLAG_PLAY_END;
}
m_flag |= ACT_FLAG_ATTEMPT_PLAY;
}
else if ((m_flag & ACT_FLAG_ACTIVE) && bNegativeEvent)
{
m_flag &= ~ACT_FLAG_ATTEMPT_PLAY;
m_localtime = obj->GetActionFrame(m_layer);
bAction *curr_action = obj->GetCurrentAction(m_layer);
if (curr_action && curr_action != m_action)
{
// Someone changed the action on us, so we wont mess with it
// Hopefully there wont be too many problems with two actuators using
// the same action...
m_flag &= ~ACT_FLAG_ACTIVE;
return false;
}
switch(m_playtype)
{
case ACT_ACTION_LOOP_STOP:
obj->StopAction(m_layer); // Stop the action after getting the frame
// We're done
m_flag &= ~ACT_FLAG_ACTIVE;
return false;
case ACT_ACTION_LOOP_END:
// Convert into a play and let it finish
obj->SetPlayMode(m_layer, BL_Action::ACT_MODE_PLAY);
m_flag |= ACT_FLAG_PLAY_END;
break;
case ACT_ACTION_FLIPPER:
// Convert into a play action and play back to the beginning
end = start;
start = obj->GetActionFrame(m_layer);
obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, 0, BL_Action::ACT_MODE_PLAY, m_layer_weight, m_ipo_flags);
m_flag |= ACT_FLAG_PLAY_END;
break;
}
}
return m_flag & ACT_FLAG_ACTIVE;
}