exit vehicle when walking around

This commit is contained in:
in0finite 2021-09-12 18:22:04 +02:00
parent cf28bd5c63
commit c40f19348a

View file

@ -114,13 +114,7 @@ namespace SanAndreasUnity.Behaviours
switch (this.Action)
{
case PedAIAction.WalkingAround:
if (this.ArrivedAtDestinationNode())
{
this.OnArrivedToDestinationNode();
}
this.MyPed.IsWalkOn = true;
this.MyPed.Movement = (_moveDestination - this.MyPed.transform.position).normalized;
this.MyPed.Heading = this.MyPed.Movement;
this.UpdateWalkingAround();
break;
case PedAIAction.Chasing:
if (this.TargetPed != null)
@ -165,6 +159,26 @@ namespace SanAndreasUnity.Behaviours
_moveDestination = TargetNode.Position + offset.ToVector3XZ();
}
void UpdateWalkingAround()
{
if (this.MyPed.IsInVehicleSeat)
{
// exit vehicle
this.MyPed.OnSubmitPressed();
return;
}
if (this.MyPed.IsInVehicle) // wait until we exit vehicle
return;
if (this.ArrivedAtDestinationNode())
this.OnArrivedToDestinationNode();
this.MyPed.IsWalkOn = true;
this.MyPed.Movement = (_moveDestination - this.MyPed.transform.position).normalized;
this.MyPed.Heading = this.MyPed.Movement;
}
void UpdateFollowing()
{
if (null == this.TargetPed)