This commit is contained in:
2026-06-11 22:49:50 +07:00
parent 458c338b27
commit e85e66002f
4105 changed files with 1435727 additions and 11 deletions

View File

@@ -0,0 +1,44 @@
using UnityEngine;
using UnityEditor;
using Pathfinding.Graphs.Grid;
namespace Pathfinding {
[CustomGraphEditor(typeof(LayerGridGraph), "Layered Grid Graph")]
public class LayerGridGraphEditor : GridGraphEditor {
protected override void DrawMiddleSection (GridGraph graph) {
var layerGridGraph = graph as LayerGridGraph;
DrawNeighbours(graph);
layerGridGraph.characterHeight = EditorGUILayout.DelayedFloatField("Character Height", layerGridGraph.characterHeight);
DrawMaxClimb(graph);
DrawMaxSlope(graph);
DrawErosion(graph);
}
protected override void DrawMaxClimb (GridGraph graph) {
var layerGridGraph = graph as LayerGridGraph;
base.DrawMaxClimb(graph);
layerGridGraph.maxStepHeight = Mathf.Clamp(layerGridGraph.maxStepHeight, 0, layerGridGraph.characterHeight);
if (layerGridGraph.maxStepHeight >= layerGridGraph.characterHeight) {
EditorGUILayout.HelpBox("Max step height needs to be smaller or equal to character height", MessageType.Info);
}
}
protected override void DrawCollisionEditor (GraphCollision collision) {
base.DrawCollisionEditor(collision);
if (collision.thickRaycast) {
EditorGUILayout.HelpBox("Note: Thick raycast cannot be used with this graph type", MessageType.Error);
}
}
protected override void DrawUse2DPhysics (GraphCollision collision) {
// 2D physics does not make sense for a layered grid graph
collision.use2D = false;
}
}
}