本文整理汇总了C++中SetAnimation函数的典型用法代码示例。如果您正苦于以下问题:C++ SetAnimation函数的具体用法?C++ SetAnimation怎么用?C++ SetAnimation使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetAnimation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetAnimation
void UNIT::Update(float deltaTime)
{
//update unit animation time
m_time += deltaTime * 0.8f * m_speed;
//if the unit is moving...
if(m_moving)
{
if(m_movePrc < 1.0f)m_movePrc += deltaTime * m_speed;
if(m_movePrc > 1.0f)m_movePrc = 1.0f;
//waypoint reached
if(m_movePrc == 1.0f)
{
if(m_activeWP + 1 >= (int)m_path.size()) //goal reached
{
m_moving = false;
SetAnimation("Still");
}
else if(!CheckCollision(m_path[m_activeWP + 1])) //Next Waypoint
{
m_activeWP++;
SetAnimation("Run");
MoveUnit(m_path[m_activeWP]);
}
}
//Interpolate position between m_lastWP and m_nextWP
m_position = m_lastWP * (1.0f - m_movePrc) + m_nextWP * m_movePrc;
}
}
示例2: SetAnimation
/*
==============================
PostThink
==============================
*/
void CBasePlayer::PostThink()
{
if ( !g_runfuncs )
return;
// select the proper animation for the player character
if ( !CL_IsDead() && (m_flTouchedByJumpPad < gpGlobals->time) )
{
if (!pev->velocity.x && !pev->velocity.y)
SetAnimation( PLAYER_IDLE );
else if ((pev->velocity.x || pev->velocity.y) && (FBitSet(pev->flags, FL_ONGROUND)))
SetAnimation( PLAYER_WALK );
else if (pev->waterlevel > 1)
SetAnimation( PLAYER_WALK );
}
if ( !CL_IsDead() && ( m_flThrowTime <= 0.0 ) )
{
m_Activity = ACT_BASE_WALK;
m_flThrowTime = 0.0;
if (!pev->velocity.x && !pev->velocity.y)
{
SetAnimation( PLAYER_IDLE );
}
else
{
SetAnimation( PLAYER_WALK );
}
}
// Store old velocity for use in backpedalling animations
m_vecOldVelocity = pev->velocity;
m_vecOldVelocity.Normalize();
}
示例3: SetAnimation
void GameEntity::Input()
{
if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_W))
{
SetAnimation("LookUp",ONCE);
SwapUVs(UP);
}
if
(GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_A))
{
SetAnimation("Run",LOOP);
SwapUVs(LEFT);
m_v3Position -= Vector3(1.f, 0.0f, 0.0f);
}
if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_S))
{
SetAnimation("Duck",LOOP);
SwapUVs(DOWN);
m_v3Position += Vector3(0.0f, -1.f, 0.0f);
}
if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_D))
{
if(FacingCheck("RIGHT") != true) // if the sprite isn't already facing right..
{
SetAnimation("TurnAround", ONCE); //Set the animation to turn around...
SwapUVs(RIGHT); //Swap UV's to flip the sprite...
iFacing = "Right"; // Sets the facing flag to Right.
if (currentAnimation !="Run")
{
SetAnimation("Run",LOOP);
m_v3Position += Vector3(1.f, 0.0f, 0.0f);
}
}
else
SwapUVs(RIGHT);
m_v3Position += Vector3(1.f, 0.0f, 0.0f);
}
if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_SPACE))
{
//if(this->Hitbox.CheckGrounded)
}
if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_V))
{
SetColor(
Vector4((rand()%255)/255.f,(rand()%255)/255.f,(rand()%255)/255.f,1.f),
Vector4((rand()%255)/255.f,(rand()%255)/255.f,(rand()%255)/255.f,1.f),
Vector4((rand()%255)/255.f,(rand()%255)/255.f,(rand()%255)/255.f,1.f),
Vector4((rand()%255)/255.f,(rand()%255)/255.f,(rand()%255)/255.f,1.f)
);
}
}
示例4: SetNewState
void OpheliaREV::MC_BestWeapon()
{
CWeapon* pW = m_InventoryMgr.GetCurrentWeapon();
if(pW == DNULL)
{
SetNewState(STATE_Idle);
return;
}
if (m_bAnimating == DFALSE)
{
if(pW)
{
if(m_InventoryMgr.GetAmmoCount(pW->GetAmmoType(DFALSE)) <= 0.0)
{
SetAnimation( m_pAnim_Sound->m_nAnim_SWITCH_WEAPON[pW->GetFireType()]);
m_pServerDE->SetModelLooping(m_hObject, DFALSE);
m_bAnimating = DTRUE;
}
else
{
m_bAnimating = DFALSE;
Metacmd++;
}
}
}
else
{
//Are we done?
if(m_pServerDE->GetModelPlaybackState(m_hObject) & MS_PLAYDONE)
{
if(pW->GetType() == WEAP_TESLACANNON)
{
m_InventoryMgr.ChangeWeapon(WEAP_SNIPERRIFLE);
pW = m_InventoryMgr.GetCurrentWeapon();
pW->ShowHandModel(DFALSE);
SetAnimation( m_pAnim_Sound->m_nAnim_SWITCH_WEAPON[pW->GetFireType()]);
}
else
{
if(m_InventoryMgr.GetAmmoCount(pW->GetAmmoType(DFALSE)) <= 0.0)
{
SetNewState(STATE_FindAmmo);
}
else
{
m_bAnimating = DFALSE;
Metacmd++;
}
}
}
}
return;
}
示例5: SetAnimation
void EnemyPunk::stop()
{
//Stop All Movement
velMovement = 0;
//Reset Animation
if(ipFlags.PrevMState != move_stop) SetAnimation(ENEMY_PUNK_ANIM_STAND, 0, false, false, 15, true);
else SetAnimation(ENEMY_PUNK_ANIM_STAND, 0, false, false, 15, false);
}
示例6: SetAnimation
void EnemyJunkbotFlying::processDown()
{
if(ipFlags.PrevMState != move_down)
SetAnimation(ENEMY_JUNKBOT_FLYING_MOVE, 0, true, false, 15, true);
else
SetAnimation(ENEMY_JUNKBOT_FLYING_MOVE, 0, true, false, 15, false);
velYModifier = maxWalkSpeed;
}
示例7: StopMovement
void EnemyGMonsterFire::stop()
{
/* Stop All Directional Movement */
StopMovement();
/* Set Frame 0 of Attack Animation */
if(ipFlags.PrevMState != move_stop) SetAnimation(ENEMY_FIRE_MONSTER_ATTACK, 0, false, false, 15, true);
else SetAnimation(ENEMY_FIRE_MONSTER_ATTACK, 0, false, false, 15, false);
}
示例8: SetAnimation
void EnemyGreenNinja::stop()
{
//Stop All Movement
velMovement = 0;
//Reset Animation
if(ipFlags.PrevMState != move_stop)
SetAnimation(ENEMY_GREEN_NINJA_ANIM_MOVE, 0, false, false, 22, true);
else
SetAnimation(ENEMY_GREEN_NINJA_ANIM_MOVE, 0, false, false, 22, false);
}
示例9: SetAnimation
void Protagonist::ChangeStance(ePLAYER_STANCE eSTANCE)
{
if( !Player::IsDead() && eCURRENTSTANCE != eSTANCE )
{
SetAnimation(eSTANCE);
}
else if( Player::IsDead() )
{
SetAnimation(DEAD);
}
}
示例10: SetAnimation
void EnemyZombiePrisoner::stop()
{
//Stop All Movement
velMovement = 0;
//Reset Animation
if(ipFlags.PrevMState != move_stop)
SetAnimation(ENEMY_PRISONER_ZOMBIE_ANIM_MOVE, 0, true, false, 15, true);
else
SetAnimation(ENEMY_PRISONER_ZOMBIE_ANIM_MOVE, 0, true, false, 15, false);
}
示例11: SetAnimation
void Actor::SetAnimation(string s) {
if(s == "move-down") {
SetAnimation(rect.x, 550, 200);
} else if(s == "move-up") {
SetAnimation(rect.x, 0, 60);
} else if(s == "move-left") {
SetAnimation(-100, rect.y, 150);
} else if(s == "move-right") {
SetAnimation(800, rect.y, 150);
}
}
示例12: SetAnimation
void EnemyDockWorkerWrench::stop()
{
//Stop All Movement
velMovement = 0;
//Reset Animation
if(ipFlags.PrevMState != move_stop)
SetAnimation(ENEMY_DOCK_WORKER_ANIM_MOVE, 0, false, false, 22, true);
else
SetAnimation(ENEMY_DOCK_WORKER_ANIM_MOVE, 0, false, false, 22, false);
}
示例13: SetAnimation
void AnimatedSprite::Input() {
Sprite::Input();
if(GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_P)) {
SetAnimation("idle to run", LOOPSECTION, 1);
}
if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_T)) {
SetAnimation("teleport", ONCE);
}
}
示例14: SetAnimation
void EnemyPrisonerRock::stop()
{
//Stop All Movement
velMovement = 0;
//Reset Animation
if(ipFlags.PrevMState != move_stop)
SetAnimation(ENEMY_PRISONER_ANIM_THROW, 0, false, false, 22, true);
else
SetAnimation(ENEMY_PRISONER_ANIM_THROW, 0, false, false, 22, false);
}
示例15: SetAnimation
void EnemyShadowElitePistol::stop()
{
//Stop All Movement
velMovement = 0;
//Reset Animation
if(ipFlags.PrevMState != move_stop)
SetAnimation(ENEMY_PISTOL_ELITE_GUARD_ANIM_MOVE, 0, false, false, 22, true);
else
SetAnimation(ENEMY_PISTOL_ELITE_GUARD_ANIM_PISTOL_ATTACK, 0, false, false, 22, false);
}