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


C++ SetAnimation函数代码示例

本文整理汇总了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;
	}
}
开发者ID:Alriightyman,项目名称:RTS,代码行数:31,代码来源:unit.cpp

示例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();
}
开发者ID:Skumek,项目名称:hlsdk,代码行数:40,代码来源:hl_weapons.cpp

示例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)
				   );

        }
}
开发者ID:Vinessa,项目名称:VinessaAIEProgramming,代码行数:59,代码来源:GameEntity.cpp

示例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;
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:58,代码来源:OpheliaREV.cpp

示例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);
}
开发者ID:shoematt,项目名称:BladeofBetrayal,代码行数:9,代码来源:EnemyPunk.cpp

示例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;
}
开发者ID:shoematt,项目名称:BladeofBetrayal,代码行数:9,代码来源:EnemyJunkbotFlying.cpp

示例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);
}
开发者ID:duhone,项目名称:BladeofBetrayal2,代码行数:9,代码来源:EnemyGMonsterFire.cpp

示例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);
}
开发者ID:duhone,项目名称:BladeofBetrayal2,代码行数:11,代码来源:EnemyGreenNinja.cpp

示例9: SetAnimation

void Protagonist::ChangeStance(ePLAYER_STANCE eSTANCE)
{
	if( !Player::IsDead() && eCURRENTSTANCE != eSTANCE )
	{
		SetAnimation(eSTANCE);
	}
	else if( Player::IsDead() )
	{
		SetAnimation(DEAD);
	}
}
开发者ID:codinpsycho,项目名称:The_Siege,代码行数:11,代码来源:Protagonist.cpp

示例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);
}
开发者ID:duhone,项目名称:BladeofBetrayal2,代码行数:11,代码来源:EnemyZombiePrisoner.cpp

示例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);
	}
}
开发者ID:DuncanKeller,项目名称:v-novel,代码行数:11,代码来源:Actor.cpp

示例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);
}
开发者ID:shoematt,项目名称:BladeofBetrayal,代码行数:11,代码来源:EnemyDockWorkerWrench.cpp

示例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);
	}
}
开发者ID:BrendanHurt,项目名称:SimpleSpriteAnimations,代码行数:11,代码来源:Animations.cpp

示例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);
}
开发者ID:duhone,项目名称:BladeofBetrayal2,代码行数:11,代码来源:EnemyPrisonerRock.cpp

示例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);
}
开发者ID:duhone,项目名称:BladeofBetrayal2,代码行数:11,代码来源:EnemyShadowElitePistol.cpp


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