mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-26 05:50:18 +00:00
exit vehicle when walking around
This commit is contained in:
parent
cf28bd5c63
commit
c40f19348a
1 changed files with 21 additions and 7 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue