when chasing is finished, start walking from closest node

This commit is contained in:
in0finite 2021-09-12 20:05:07 +02:00
parent 82363bff84
commit 1ed58b7f09

View file

@ -126,14 +126,7 @@ namespace SanAndreasUnity.Behaviours
this.UpdateWalkingAround();
break;
case PedAIAction.Chasing:
if (this.TargetPed != null)
{
this.UpdateAttackOnPed(this.TargetPed);
}
else // The target is dead/disconnected
{
this.Action = PedAIAction.WalkingAround;
}
this.UpdateChasing();
break;
case PedAIAction.Escaping:
this.UpdateEscaping();
@ -200,6 +193,18 @@ namespace SanAndreasUnity.Behaviours
this.MyPed.Heading = this.MyPed.Movement;
}
void UpdateChasing()
{
if (this.TargetPed != null)
{
this.UpdateAttackOnPed(this.TargetPed);
}
else // The target is dead/disconnected
{
this.StartWalkingAround();
}
}
void UpdateEscaping()
{
if (this.ArrivedAtDestinationNode())