Working on vehicle sync 5

This commit is contained in:
in0finite 2019-04-29 01:15:24 +02:00
parent 63491e76ea
commit 2842d653ef
3 changed files with 13 additions and 8 deletions

View file

@ -14,6 +14,17 @@ namespace SanAndreasUnity.Behaviours.Peds.States
public Vehicle.SeatAlignment CurrentVehicleSeatAlignment { get { return this.CurrentVehicleSeat.Alignment; } } public Vehicle.SeatAlignment CurrentVehicleSeatAlignment { get { return this.CurrentVehicleSeat.Alignment; } }
protected void Cleanup()
{
if (!m_ped.IsInVehicle)
{
m_ped.characterController.enabled = true;
// restore seat's occupying ped ? - no
m_ped.transform.SetParent(null, true);
m_model.IsInVehicle = false;
}
}
protected override void UpdateHeading() protected override void UpdateHeading()
{ {

View file

@ -17,13 +17,7 @@ namespace SanAndreasUnity.Behaviours.Peds.States
{ {
// restore everything // restore everything
if (!m_ped.IsInVehicle) this.Cleanup();
{
m_ped.characterController.enabled = true;
// restore seat's occupying ped ? - no
m_ped.transform.SetParent(null, true);
m_model.IsInVehicle = false;
}
if (m_coroutine != null) if (m_coroutine != null)
StopCoroutine(m_coroutine); StopCoroutine(m_coroutine);

View file

@ -12,7 +12,7 @@ namespace SanAndreasUnity.Behaviours.Peds.States
public override void OnBecameInactive() public override void OnBecameInactive()
{ {
this.Cleanup();
base.OnBecameInactive(); base.OnBecameInactive();
} }