add NavMeshAgent

This commit is contained in:
in0finite 2022-03-07 01:02:40 +01:00
parent c9d4772da7
commit 4d157f8f0c
2 changed files with 33 additions and 0 deletions

View file

@ -373,6 +373,7 @@ GameObject:
- component: {fileID: 114220037769542022}
- component: {fileID: 8031585062060932984}
- component: {fileID: 4594788420466467901}
- component: {fileID: 7038296094652462326}
m_Layer: 11
m_Name: Ped
m_TagString: Player
@ -524,6 +525,28 @@ MonoBehaviour:
m_EditorClassIdentifier:
syncInterval: 0.1
compressRotation: 1
--- !u!195 &7038296094652462326
NavMeshAgent:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1273918895060814}
m_Enabled: 1
m_AgentTypeID: 0
m_Radius: 0.25
m_Speed: 3.5
m_Acceleration: 8
avoidancePriority: 50
m_AngularSpeed: 120
m_StoppingDistance: 0
m_AutoTraverseOffMeshLink: 1
m_AutoBraking: 1
m_AutoRepath: 1
m_Height: 1.75
m_BaseOffset: 0.875
m_WalkableMask: 5
m_ObstacleAvoidanceType: 4
--- !u!1 &1531309216951106
GameObject:
m_ObjectHideFlags: 0

View file

@ -9,6 +9,7 @@ using SanAndreasUnity.Utilities;
using System.Collections.Generic;
using System.Linq;
using SanAndreasUnity.Net;
using UnityEngine.AI;
namespace SanAndreasUnity.Behaviours
{
@ -38,6 +39,8 @@ namespace SanAndreasUnity.Behaviours
public CharacterController characterController { get; private set; }
public NavMeshAgent NavMeshAgent { get; private set; }
public float CameraDistance { get { return PedManager.Instance.cameraDistanceFromPed; } set { PedManager.Instance.cameraDistanceFromPed = value; } }
public float CameraDistanceVehicle { get { return VehicleManager.Instance.cameraDistanceFromVehicle; } set { VehicleManager.Instance.cameraDistanceFromVehicle = value; } }
@ -155,6 +158,7 @@ namespace SanAndreasUnity.Behaviours
this.PlayerModel = this.GetComponentInChildren<PedModel>();
this.characterController = this.GetComponent<CharacterController>();
this.NavMeshAgent = this.GetComponentOrThrow<NavMeshAgent>();
m_weaponHolder = GetComponent<WeaponHolder> ();
_stateContainer.AddStates(this.GetComponentsInChildren<Peds.States.BaseScriptState> ());
@ -167,6 +171,9 @@ namespace SanAndreasUnity.Behaviours
.Where(_ => !(_ is Peds.States.IAimState))
.ToArray();
this.NavMeshAgent.updatePosition = false;
this.NavMeshAgent.updateRotation = false;
this.AwakeForDamage ();
this.Awake_Net();
@ -411,6 +418,9 @@ namespace SanAndreasUnity.Behaviours
//if (IsDrivingVehicle)
// UpdateWheelTurning();
this.NavMeshAgent.nextPosition = this.transform.position;
this.UpdateDamageStuff ();
this.Update_Net();