mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-14 16:27:19 +00:00
fix for crouching states aswell
This commit is contained in:
parent
d9acfbb431
commit
3aa4175f09
2 changed files with 16 additions and 4 deletions
|
@ -14,10 +14,16 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
|
||||
protected override void SwitchToMovementState ()
|
||||
{
|
||||
if (this.TimeSinceActivated <= this.TimeUntilStateCanBeSwitchedToOtherMovementState)
|
||||
return;
|
||||
|
||||
// can only switch to Crouch state
|
||||
if( m_ped.Movement.sqrMagnitude < float.Epsilon )
|
||||
if ( m_ped.Movement.sqrMagnitude < float.Epsilon )
|
||||
{
|
||||
m_ped.SwitchState<CrouchState>();
|
||||
var crouchState = m_ped.GetState<CrouchState>();
|
||||
if (crouchState.TimeSinceDeactivated <= crouchState.TimeUntilStateCanBeEnteredFromOtherMovementState)
|
||||
return;
|
||||
m_ped.SwitchState(crouchState.GetType());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,10 +14,16 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
|
||||
protected override void SwitchToMovementState ()
|
||||
{
|
||||
if (this.TimeSinceActivated <= this.TimeUntilStateCanBeSwitchedToOtherMovementState)
|
||||
return;
|
||||
|
||||
// can only switch to CrouchMove state
|
||||
if( m_ped.Movement.sqrMagnitude > float.Epsilon )
|
||||
if ( m_ped.Movement.sqrMagnitude > float.Epsilon )
|
||||
{
|
||||
m_ped.SwitchState<CrouchMoveState>();
|
||||
var crouchMoveState = m_ped.GetState<CrouchMoveState>();
|
||||
if (crouchMoveState.TimeSinceDeactivated <= crouchMoveState.TimeUntilStateCanBeEnteredFromOtherMovementState)
|
||||
return;
|
||||
m_ped.SwitchState(crouchMoveState.GetType());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue