Exemplo n.º 1
0
void TransitionCharacter_cl::RotateLeft()
{
	// Start turning sequence only when model is in idle state
	if (m_bModelValid && !m_bIsMoving)
		m_pStateMachine->SetState("Turn");
	DoRotateLeft();
  m_bIsMoving = false;
}
Exemplo n.º 2
0
void AnimatedWarrior_cl::FullBodyRotateState::OnThink()
{
  float fRotationSpeed = ANIMATEDCHARACTER_ROTATIONSPEED / 2.0f;

  // apply entity rotation
  if ( m_rotateDir == ROTATE_LEFT )
    DoRotateLeft(fRotationSpeed);
  else
    DoRotateRight(fRotationSpeed);

  // start any delayed rotate animation as soon as the component finished blending
  if (m_bAnimStartPending && !IsBlending())
  {
//    int iMixerInputIndex = m_eStateType;

    if (m_rotateDir == ROTATE_LEFT)
    {
      // change playback direction
      m_pEnt->BlendOverFullBodyAnimation(0.2f, m_pAnimSet->iTurnID, -1.f, 0.f);
    }
    else
    {
      // change playback direction
      m_pEnt->BlendOverFullBodyAnimation(0.2f, m_pAnimSet->iTurnID, 1.f, 0.f);
    }
    m_bAnimStartPending = false;
  }

  // perform pending actions which depend on the animation component having finished blending
  if ( m_eTriggeredAction != ACTION_NONE && !IsBlending() )
  {
    switch( m_eTriggeredAction )
    {
      case ACTION_STOP:
        m_pEnt->BlendOverFullBodyAnimation(0.5f, m_pAnimSet->iIdleID, 1.f, 0.f);
        m_pEnt->SetFullBodyState(m_pEnt->m_pFullBodyIdleState[m_eStateType]);
        break;
      case ACTION_WALK:
        m_pEnt->BlendOverFullBodyAnimation(0.3f, m_pAnimSet->iWalkID, 1.f, 0.f);
        m_pEnt->SetFullBodyState(m_pEnt->m_pFullBodyWalkState[m_eStateType]);
        break;
      case ACTION_RUN:
        m_pEnt->BlendOverFullBodyAnimation(0.3f, m_pAnimSet->iRunID, 1.f, 0.f);
        m_pEnt->SetFullBodyState( m_pEnt->m_pFullBodyRunState[m_eStateType] );
        break;
      case ACTION_WALKBACKWARDS:
        m_pEnt->BlendOverFullBodyAnimation(0.3f, m_pAnimSet->iWalkBackwardsID, 1.f, 0.f);
        m_pEnt->SetFullBodyState(m_pEnt->m_pFullBodyWalkBackwardsState[m_eStateType]);
        break;
    }
    m_eTriggeredAction = ACTION_NONE;
  }
}
void TransitionBarbarian_cl::RotateLeft()
{
	DoRotateLeft();
}