Skip to content

Commit

Permalink
Added HasPath property to the Custom Agent.
Browse files Browse the repository at this point in the history
  • Loading branch information
jadvrodrigues committed Apr 28, 2023
1 parent 05b3653 commit 4db0e25
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
5 changes: 5 additions & 0 deletions Assets/CustomNavMesh/Scripts/CustomNavMeshAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ public Vector3[] PathCorners
}
}

/// <summary>
/// Does the agent currently have a path? (Read Only)
/// </summary>
public bool HasPath => HiddenAgent ? HiddenAgent.HasPath : false;

[SerializeField] float m_Acceleration = 8.0f;
/// <summary>
/// The maximum acceleration of an agent as it follows a path, given in units / sec^2.
Expand Down
5 changes: 5 additions & 0 deletions Assets/CustomNavMesh/Scripts/HiddenNavMeshAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public Vector3 Velocity
/// </summary>
public Vector3 DesiredVelocity => Agent.enabled ? Agent.desiredVelocity : Vector3.zero;

/// <summary>
/// Does the agent currently have a path? (Read Only)
/// </summary>
public bool HasPath => Agent.enabled ? Agent.hasPath : false;

/// <summary>
/// Access the current destination of the hidden agent component.
/// Returns transform.position if it is disabled.
Expand Down
26 changes: 13 additions & 13 deletions UserSettings/Layouts/default-2021.dwlt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ MonoBehaviour:
width: 1536
height: 780.8
m_ShowMode: 4
m_Title: Hierarchy
m_Title: Game
m_RootView: {fileID: 8}
m_MinSize: {x: 875, y: 421}
m_MaxSize: {x: 10000, y: 10000}
Expand Down Expand Up @@ -69,8 +69,8 @@ MonoBehaviour:
y: 0
width: 473.60004
height: 449.6
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 202, y: 221}
m_MaxSize: {x: 4002, y: 4021}
m_ActualView: {fileID: 17}
m_Panes:
- {fileID: 17}
Expand Down Expand Up @@ -100,7 +100,7 @@ MonoBehaviour:
m_MinSize: {x: 400, y: 200}
m_MaxSize: {x: 32384, y: 16192}
vertical: 0
controlID: 41
controlID: 21
--- !u!114 &5
MonoBehaviour:
m_ObjectHideFlags: 52
Expand All @@ -120,8 +120,8 @@ MonoBehaviour:
y: 0
width: 459.19995
height: 730.8
m_MinSize: {x: 275, y: 50}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 276, y: 71}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 15}
m_Panes:
- {fileID: 15}
Expand Down Expand Up @@ -276,7 +276,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 200}
m_MaxSize: {x: 24288, y: 16192}
vertical: 1
controlID: 17
controlID: 110
--- !u!114 &12
MonoBehaviour:
m_ObjectHideFlags: 52
Expand All @@ -302,7 +302,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 100}
m_MaxSize: {x: 24288, y: 8096}
vertical: 0
controlID: 18
controlID: 111
--- !u!114 &13
MonoBehaviour:
m_ObjectHideFlags: 52
Expand Down Expand Up @@ -391,7 +391,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 63.80002}
m_SelectedIDs: 984b0000
m_LastClickedID: 19352
m_ExpandedIDs: 000000007a4b0000844b0000984b000000ca9a3bffffff7f
m_ExpandedIDs: 000000007a4b0000844b000000ca9a3bffffff7f
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
Expand Down Expand Up @@ -446,7 +446,7 @@ MonoBehaviour:
m_ListAreaState:
m_SelectedInstanceIDs:
m_LastClickedInstanceID: 0
m_HadKeyboardFocusLastEvent: 1
m_HadKeyboardFocusLastEvent: 0
m_ExpandedInstanceIDs: c6230000
m_RenameOverlay:
m_UserAcceptedRename: 0
Expand Down Expand Up @@ -512,7 +512,7 @@ MonoBehaviour:
m_ControlHash: -371814159
m_PrefName: Preview_InspectorPreview
m_LastInspectedObjectInstanceID: -1
m_LastVerticalScrollValue: 700.0001
m_LastVerticalScrollValue: 0
m_GlobalObjectId:
m_InspectorMode: 0
m_LockTracker:
Expand Down Expand Up @@ -553,7 +553,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 0a70ffff9a70ffffcc74ffffb675ffff2095ffffde96ffffc6b8fffffebaffffb4f7ffff34fbffff144c0000664c00004c6700008c7e0000
m_ExpandedIDs: 36fbffff
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
Expand Down Expand Up @@ -888,7 +888,7 @@ MonoBehaviour:
m_Rotation:
m_Target: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
speed: 2
m_Value: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_Value: {x: -0.7071068, y: 0, z: -0, w: -0.7071068}
m_Size:
m_Target: 13.103616
speed: 2
Expand Down

0 comments on commit 4db0e25

Please sign in to comment.