[Player] Add AI Pathfinding on a 2D grid to the player character

This commit is contained in:
Michal Pikulski
2025-09-02 11:42:25 +02:00
parent 3d3b72f04d
commit e53b5a0034
663 changed files with 148320 additions and 66 deletions

View File

@@ -0,0 +1,24 @@
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
namespace Pathfinding {
[CustomEditor(typeof(AnimationLink))]
public class AnimationLinkEditor : Editor {
public override void OnInspectorGUI () {
DrawDefaultInspector();
var script = target as AnimationLink;
EditorGUI.BeginDisabledGroup(script.EndTransform == null);
if (GUILayout.Button("Autoposition Endpoint")) {
List<Vector3> buffer = Pathfinding.Util.ListPool<Vector3>.Claim();
Vector3 endpos;
script.CalculateOffsets(buffer, out endpos);
script.EndTransform.position = endpos;
Pathfinding.Util.ListPool<Vector3>.Release(buffer);
}
EditorGUI.EndDisabledGroup();
}
}
}