本文整理汇总了C++中ISkeletonAnim::StartAnimation方法的典型用法代码示例。如果您正苦于以下问题:C++ ISkeletonAnim::StartAnimation方法的具体用法?C++ ISkeletonAnim::StartAnimation怎么用?C++ ISkeletonAnim::StartAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISkeletonAnim
的用法示例。
在下文中一共展示了ISkeletonAnim::StartAnimation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PlayAnimation
bool CBoidObject::PlayAnimation( const char *animation, bool bLooped, float fBlendTime )
{
bool playing = false;
if (m_object)
{
ISkeletonAnim* pSkeleton = m_object->GetISkeletonAnim();
assert(pSkeleton);
CryCharAnimationParams animParams;
if (bLooped)
animParams.m_nFlags |= CA_LOOP_ANIMATION;
animParams.m_fTransTime = fBlendTime;
const int amountAnimationsInFIFO = pSkeleton->GetNumAnimsInFIFO(0);
const uint32 maxAnimationsAllowedInQueue = 2;
if(amountAnimationsInFIFO >= maxAnimationsAllowedInQueue)
{
animParams.m_nFlags |= CA_REMOVE_FROM_FIFO;
}
playing = pSkeleton->StartAnimation( animation, animParams );
assert(pSkeleton->GetNumAnimsInFIFO(0) <= maxAnimationsAllowedInQueue);
m_object->SetPlaybackScale( 1.0f );
}
return playing;
}
示例2: PlayAnimationEx
//------------------------------------------------------------------------
void CItem::PlayAnimationEx(const char* animationName, int slot, int layer, bool loop, float blend, float speed, uint32 flags)
{
bool start=true;
ICharacterInstance *pCharacter = GetEntity()->GetCharacter(slot);
if (!pCharacter && slot==eIGS_FirstPerson && ((m_stats.viewmode&eIVM_FirstPerson)==0))
{
start=false;
int idx = 0;
if (m_stats.hand == eIH_Right)
idx = 1;
else if (m_stats.hand == eIH_Left)
idx = 2;
if (m_fpgeometry[idx].name.empty())
idx = 0;
pCharacter = m_pItemSystem->GetCachedCharacter(m_fpgeometry[idx].name.c_str());
}
if (pCharacter && animationName)
{
ISkeletonAnim* pSkeletonAnim = pCharacter->GetISkeletonAnim();
if (flags&eIPAF_CleanBlending)
{
while(pSkeletonAnim->GetNumAnimsInFIFO(layer)>1)
{
if (!pSkeletonAnim->RemoveAnimFromFIFO(layer, pSkeletonAnim->GetNumAnimsInFIFO(layer)-1))
break;
}
}
if (flags&eIPAF_NoBlend)
blend = 0.0f;
if (start)
{
CryCharAnimationParams params;
params.m_fTransTime = blend;
params.m_nLayerID = layer;
params.m_nFlags = (loop?CA_LOOP_ANIMATION:0)|(flags&eIPAF_RestartAnimation?CA_ALLOW_ANIM_RESTART:0)|(flags&eIPAF_RepeatLastFrame?CA_REPEAT_LAST_KEY:0);
pSkeletonAnim->StartAnimation(animationName, params);
pSkeletonAnim->SetLayerUpdateMultiplier(layer, speed);
//pCharacter->GetISkeleton()->SetDebugging( true );
}
float duration=0.0f;
int animationId = pCharacter->GetIAnimationSet()->GetAnimIDByName(animationName);
if (animationId>=0)
duration = pCharacter->GetIAnimationSet()->GetDuration_sec(animationId);
m_animationTime[slot] = (uint32)(duration*1000.0f/speed);
m_animationEnd[slot] = (uint32)(gEnv->pTimer->GetCurrTime()*1000.0f)+m_animationTime[slot];
m_animationSpeed[slot] = speed;
}
}
示例3: PlayAnimation
void CScriptbind_Entity::PlayAnimation(IEntity *pEntity, mono::string animationName, int slot, int layer, float blend, float speed, EAnimationFlags flags)
{
// Animation graph input
/*if(IGameObject *pGameObject = static_cast<CScriptSystem *>(GetMonoScriptSystem())->GetIGameFramework()->GetGameObject(pEntity->GetId()))
{
if(IAnimatedCharacter *pAniamtedCharacter = static_cast<IAnimatedCharacter*>(pGameObject->AcquireExtension("AnimatedCharacter")))
{
pAniamtedCharacter->GetAnimationGraphState()->SetInput("Action / "Signal"
}
}*/
ICharacterInstance *pCharacter = pEntity->GetCharacter(slot);
if(!pCharacter)
return;
ISkeletonAnim *pSkeletonAnim = pCharacter->GetISkeletonAnim();
if(!pSkeletonAnim)
return;
if(flags & EAnimFlag_CleanBending)
{
while(pSkeletonAnim->GetNumAnimsInFIFO(layer)>1)
{
if (!pSkeletonAnim->RemoveAnimFromFIFO(layer, pSkeletonAnim->GetNumAnimsInFIFO(layer)-1))
break;
}
}
if (flags & EAnimFlag_NoBlend)
blend = 0.0f;
CryCharAnimationParams params;
params.m_fTransTime = blend;
params.m_nLayerID = layer;
params.m_fPlaybackSpeed = speed;
params.m_nFlags = (flags & EAnimFlag_Loop ? CA_LOOP_ANIMATION : 0) | (flags & EAnimFlag_RestartAnimation ? CA_ALLOW_ANIM_RESTART : 0) | (flags & EAnimFlag_RepeatLastFrame ? CA_REPEAT_LAST_KEY : 0);
pSkeletonAnim->StartAnimation(ToCryString(animationName), params);
}
示例4: StartAnimationForCurrentAnimationState
void CLivingEntitySample::StartAnimationForCurrentAnimationState()
{
IEntity* pEntity = GetEntity();
const int slot = 0;
ICharacterInstance* pCharacterInstance = pEntity->GetCharacter( slot );
if ( pCharacterInstance == NULL )
{
return;
}
ISkeletonAnim* pSkeletonAnim = pCharacterInstance->GetISkeletonAnim();
if ( pSkeletonAnim == NULL )
{
return;
}
CryCharAnimationParams animationParams;
animationParams.m_nFlags |= CA_LOOP_ANIMATION;
animationParams.m_nLayerID = 0;
animationParams.m_fTransTime = 0.3f;
const char* animationName = IDLE_ANIMATION_NAME;
switch ( m_animationState )
{
case None:
case Idle:
animationName = IDLE_ANIMATION_NAME;
break;
case Walk:
animationName = WALK_ANIMATION_NAME;
break;
}
pSkeletonAnim->StartAnimation( animationName, animationParams );
}