mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-22 20:13:02 +00:00
dont quickly switch between drive-by and sitting states
This commit is contained in:
parent
184f1fabc3
commit
197b0d58ff
1 changed files with 13 additions and 0 deletions
|
@ -47,7 +47,17 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
}
|
||||
}
|
||||
|
||||
private float m_lastTimeWhenDeactivated = 0f;
|
||||
|
||||
public float timeUntilAbleToSwitchState = 0.3f;
|
||||
|
||||
|
||||
|
||||
public override void OnBecameInactive()
|
||||
{
|
||||
m_lastTimeWhenDeactivated = Time.time;
|
||||
base.OnBecameInactive();
|
||||
}
|
||||
|
||||
protected override void EnterVehicleInternal()
|
||||
{
|
||||
|
@ -65,6 +75,9 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
|
||||
public bool CanEnterState(Vehicle vehicle, Vehicle.SeatAlignment seatAlignment)
|
||||
{
|
||||
if (Time.time - m_lastTimeWhenDeactivated > this.timeUntilAbleToSwitchState)
|
||||
return false;
|
||||
|
||||
var w = m_ped.CurrentWeapon;
|
||||
return null != w && w.IsGun;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue