SanAndreasUnity/Assets/Scripts/Behaviours/Ped/States/CrouchMoveState.cs

46 lines
937 B
C#
Raw Normal View History

2020-05-31 17:07:22 +00:00
using UnityEngine;
using SanAndreasUnity.Utilities;
using SanAndreasUnity.Importing.Animation;
namespace SanAndreasUnity.Behaviours.Peds.States
{
public class CrouchMoveState : BaseMovementState
{
public override AnimId movementAnim { get { return new AnimId ("ped", "GunCrouchFwd"); } }
public override AnimId movementWeaponAnim { get { return this.movementAnim; } }
protected override void SwitchToMovementState ()
{
// can only switch to Crouch state
if( m_ped.Movement.sqrMagnitude < float.Epsilon )
{
m_ped.SwitchState<CrouchState>();
}
}
protected override void SwitchToAimState ()
{
// can only switch to CrouchAim state
CrouchState.SwitchToAimState(m_ped);
}
public override void OnJumpPressed ()
{
// ignore
}
public override void OnCrouchButtonPressed ()
{
2019-04-28 16:28:49 +00:00
if (m_isServer)
m_ped.SwitchState<StandState>();
2019-04-28 17:13:01 +00:00
else
base.OnCrouchButtonPressed();
2020-05-31 17:07:22 +00:00
}
}
}