Yohann Puyhaubert
4 年前
当前提交
22788ea0
共有 8 个文件被更改,包括 88 次插入 和 54 次删除
-
14UOP1_Project/Assets/Prefabs/Characters/SlimeCritter_Base.prefab
-
2UOP1_Project/Assets/Scenes/WIP/TestingGround.unity
-
14UOP1_Project/Assets/ScriptableObjects/StateMachine/Config/NPCPathwayConfig.asset
-
2UOP1_Project/Assets/ScriptableObjects/StateMachine/Config/NPCPathwayConfig.asset.meta
-
18UOP1_Project/Assets/Scripts/Characters/Config/PathwayConfigSO.cs
-
26UOP1_Project/Assets/Scripts/Editor/Pathway/PathwayEditor.cs
-
55UOP1_Project/Assets/Scripts/Editor/Pathway/PathwayGizmos.cs
-
11UOP1_Project/Assets/Scripts/Editor/Pathway/PathwayHandles.cs
2
UOP1_Project/Assets/Scenes/WIP/TestingGround.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using UnityEngine.AI; |
|||
[DrawGizmo(GizmoType.Selected)] |
|||
private static void DrawGizmosSelected(Pathway pathway, GizmoType gizmoType) |
|||
{ |
|||
|
|||
DrawHandlesPath(pathway); |
|||
} |
|||
|
|||
private static void DrawElements(Pathway pathway, List<Vector3> path, int index) |
|||
{ |
|||
GUIStyle style = new GUIStyle(); |
|||
Vector3 textHeight = Vector3.up; |
|||
|
|||
style.normal.textColor = pathway.TextColor; |
|||
style.fontSize = pathway.TextSize; |
|||
|
|||
Handles.Label(path[index] + textHeight, index.ToString(), style); |
|||
} |
|||
|
|||
private static void DrawHandlesPath(Pathway pathway) |
|||
public static void DrawHandlesPath(PathwayConfigSO pathway) |
|||
|
|||
for (int i = 0; i < pathway.Waypoints.Count; i++) |
|||
if (pathway.Waypoints.Count > 1) |
|||
if (i != 0 && pathway.Waypoints.Count > 1) |
|||
for (int index = 0; index < pathway.Waypoints.Count && pathway.Waypoints.Count > 1; index++) |
|||
DrawElements(pathway, pathway.Waypoints, i); |
|||
int nextIndex = (index + 1) % pathway.Waypoints.Count; |
|||
DrawElements(pathway, pathway.Waypoints, index); |
|||
List<Vector3> navMeshPath = new List<Vector3>(); |
|||
NavMeshPath navPath = new NavMeshPath(); |
|||
NavMesh.CalculatePath(pathway.Waypoints[index], pathway.Waypoints[nextIndex], NavMesh.AllAreas, navPath); |
|||
Handles.DrawDottedLine(pathway.Waypoints[i - 1], pathway.Waypoints[i], 2); |
|||
for (int j = 0; j < navPath.corners.Length - 1; j++) |
|||
{ |
|||
Handles.DrawDottedLine(navPath.corners[j], navPath.corners[j + 1], 2); |
|||
} |
|||
|
|||
} |
|||
if (pathway.Waypoints.Count > 2) |
|||
{ |
|||
using (new Handles.DrawingScope(pathway.LineColor)) |
|||
{ |
|||
Handles.DrawDottedLine(pathway.Waypoints[0], pathway.Waypoints[pathway.Waypoints.Count - 1], 2); |
|||
} |
|||
} |
|||
private static void DrawElements(PathwayConfigSO pathway, List<Vector3> path, int index) |
|||
{ |
|||
GUIStyle style = new GUIStyle(); |
|||
Vector3 textHeight = Vector3.up; |
|||
|
|||
style.normal.textColor = pathway.TextColor; |
|||
style.fontSize = pathway.TextSize; |
|||
Handles.Label(path[index] + textHeight, index.ToString(), style); |
|||
|
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue