mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-22 12:03:04 +00:00
split Recruit()
This commit is contained in:
parent
307552980b
commit
61f18fb3d1
5 changed files with 32 additions and 16 deletions
|
@ -69,6 +69,10 @@ namespace SanAndreasUnity.Behaviours.Peds.AI
|
|||
{
|
||||
}
|
||||
|
||||
protected internal virtual void OnRecruit(Ped recruiterPed)
|
||||
{
|
||||
}
|
||||
|
||||
protected internal virtual void OnDrawGizmosSelected()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -227,6 +227,15 @@ namespace SanAndreasUnity.Behaviours.Peds.AI
|
|||
|
||||
}
|
||||
|
||||
protected internal override void OnRecruit(Ped recruiterPed)
|
||||
{
|
||||
if (this.TargetPed == recruiterPed)
|
||||
{
|
||||
// unfollow
|
||||
this.TargetPed = null;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsMemberOfOurGroup(Ped ped)
|
||||
{
|
||||
if (this.TargetPed == null) // we are not part of any group
|
||||
|
|
|
@ -35,5 +35,18 @@ namespace SanAndreasUnity.Behaviours.Peds.AI
|
|||
_pedAI.StartEscaping();
|
||||
|
||||
}
|
||||
|
||||
protected internal override void OnRecruit(Ped recruiterPed)
|
||||
{
|
||||
this.HandleOnRecruit(recruiterPed);
|
||||
}
|
||||
|
||||
public void HandleOnRecruit(Ped recruiterPed)
|
||||
{
|
||||
if (!_pedAI.PedestrianType.IsGangMember() && !_pedAI.PedestrianType.IsCriminal())
|
||||
return;
|
||||
|
||||
_pedAI.StartFollowing(recruiterPed);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -194,22 +194,7 @@ namespace SanAndreasUnity.Behaviours.Peds.AI
|
|||
|
||||
public void Recruit(Ped recruiterPed)
|
||||
{
|
||||
if (this.Action == PedAIAction.Following)
|
||||
{
|
||||
if (this.TargetPed == recruiterPed)
|
||||
{
|
||||
// unfollow
|
||||
this.TargetPed = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (this.Action == PedAIAction.Idle || this.Action == PedAIAction.WalkingAround)
|
||||
{
|
||||
if (!this.PedestrianType.IsGangMember() && !this.PedestrianType.IsCriminal())
|
||||
return;
|
||||
|
||||
this.StartFollowing(recruiterPed);
|
||||
}
|
||||
this.CurrentState.OnRecruit(recruiterPed);
|
||||
}
|
||||
|
||||
private static PathNode GetNextPathNode(PathNode previousNode, PathNode currentNode)
|
||||
|
|
|
@ -76,5 +76,10 @@ namespace SanAndreasUnity.Behaviours.Peds.AI
|
|||
{
|
||||
_pedAI.StateContainer.GetStateOrThrow<IdleState>().HandleOnMyPedDamaged(dmgInfo, dmgResult);
|
||||
}
|
||||
|
||||
protected internal override void OnRecruit(Ped recruiterPed)
|
||||
{
|
||||
_pedAI.StateContainer.GetStateOrThrow<IdleState>().HandleOnRecruit(recruiterPed);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue