void CAnimActionAIStance::SetMovementParameters()
{
	IAnimatedCharacter* pAnimatedCharacter = m_pPlayer->GetAnimatedCharacter();
	if ( pAnimatedCharacter )
	{
		CAIAnimationComponent* pAnimationComponent = m_pPlayer->GetAIAnimationComponent();
		CRY_ASSERT( pAnimationComponent );
		if (pAnimationComponent->GetUseLegacyCoverLocator())
		{
			const bool toCoverStance = ( m_targetStance == STANCE_HIGH_COVER || m_targetStance == STANCE_LOW_COVER );
			if ( toCoverStance )
			{
				pAnimatedCharacter->SetMovementControlMethods( eMCM_Entity, eMCM_Entity );
				pAnimatedCharacter->UseAnimationMovementForEntity( true, true, false );
			}
			else
			{
				pAnimatedCharacter->SetMovementControlMethods( eMCM_AnimationHCollision, eMCM_Entity );
			}
		}
		else
		{
			pAnimatedCharacter->SetMovementControlMethods( eMCM_AnimationHCollision, eMCM_Entity );
		}
	}
}
예제 #2
0
int CScriptBind_Actor::SetMovementControlledByAnimation(IFunctionHandler *pH, bool enable)
{
		CActor *pActor = GetActor(pH);
		if (!pActor)
				return pH->EndFunction();

		IAnimatedCharacter* pAnimChar = pActor->GetAnimatedCharacter();
		if (!pAnimChar)
				return pH->EndFunction();

		if(enable)
		{
				pAnimChar->SetMovementControlMethods(eMCM_AnimationHCollision, eMCM_Animation);
				pAnimChar->UseAnimationMovementForEntity( true, true, true );
		}
		else
		{
				pAnimChar->SetMovementControlMethods( eMCM_Entity, eMCM_Entity );
				pAnimChar->UseAnimationMovementForEntity( false, false, false );
		}
		
		return pH->EndFunction();
}
void CAnimActionAIStance::RestoreMovementParameters()
{
	// We are currently not storing the parameters from SetMovementParameters, but going back to hopefully reasonable defaults instead.
	IAnimatedCharacter* pAnimatedCharacter = m_pPlayer->GetAnimatedCharacter();
	if ( pAnimatedCharacter )
	{
		pAnimatedCharacter->SetMovementControlMethods( eMCM_Entity, eMCM_Entity );

		CAIAnimationComponent* pAnimationComponent = m_pPlayer->GetAIAnimationComponent();
		CRY_ASSERT( pAnimationComponent );
		if (pAnimationComponent->GetUseLegacyCoverLocator())
		{
			pAnimatedCharacter->UseAnimationMovementForEntity( false, false, false );
		}
	}
}
예제 #4
0
void CNetPlayerInput::Update()
{
	if (gEnv->bServer && (g_pGameCVars->sv_input_timeout>0) && ((gEnv->pTimer->GetFrameStartTime()-m_lastUpdate).GetMilliSeconds()>=g_pGameCVars->sv_input_timeout))
	{
		m_curInput.deltaMovement.zero();
		// PLAYERPREDICTION
		m_curInput.sprint=false;
		m_curInput.stance=(uint8)STANCE_NULL;

		CHANGED_NETWORK_STATE(m_pPlayer,  IPlayerInput::INPUT_ASPECT );
		// ~PLAYERPREDICTION
	}

	// Disallow animation movement control for remotely controlled
	// characters.  We'll rely on the interpolation to server-controlled
	// location & rotation.
	if( m_pPlayer && m_pPlayer->GetAnimatedCharacter() )
	{
		IAnimatedCharacter* pAnimChar = m_pPlayer->GetAnimatedCharacter();
		pAnimChar->SetMovementControlMethods( eMCM_Entity, eMCM_Entity );
		pAnimChar->UseAnimationMovementForEntity( false, false, false );
	}
}