Add new meta files and interfaces for project structure

This commit is contained in:
2025-07-11 21:46:14 +02:00
commit 43c1730ed5
3230 changed files with 1428743 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
{
"name": "AstarPathfindingProjectExamplesEditor",
"rootNamespace": "",
"references": [
"GUID:efa45043feb7e4147a305b73b5cea642",
"GUID:774e21169c4ac4ec8a01db9cdb98d33b",
"GUID:f4059aaf6c60a4a58a177a2609feb769",
"GUID:de4e6084e6d474788bb8c799d6b461eb",
"GUID:9fc7298e05e4fb644bfd10f41ae01ac3"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"MODULE_BURST",
"MODULE_MATHEMATICS",
"MODULE_COLLECTIONS"
],
"versionDefines": [
{
"name": "com.unity.burst",
"expression": "1.8.7",
"define": "MODULE_BURST"
},
{
"name": "com.unity.mathematics",
"expression": "1.2.6",
"define": "MODULE_MATHEMATICS"
},
{
"name": "com.unity.collections",
"expression": "1.5.1",
"define": "MODULE_COLLECTIONS"
},
{
"name": "com.unity.collections",
"expression": "0.11-preview",
"define": "MODULE_COLLECTIONS_0_11_0_OR_NEWER"
},
{
"name": "com.unity.entities",
"expression": "1.1.0-pre.3",
"define": "MODULE_ENTITIES"
}
],
"noEngineReferences": false
}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: f5d2c271bbce11444b0479e9cf877d6d
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 87744
packageName: A* Pathfinding Project Pro
packageVersion: 5.3.8
assetPath: Packages/com.arongranberg.astar/ExampleScenes~/ExampleScripts/Editor/AstarPathfindingProjectExamplesEditor.asmdef
uploadId: 764484

View File

@@ -0,0 +1,132 @@
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using Pathfinding.Examples;
using System.Collections.Generic;
using UnityEngine.AI;
namespace Pathfinding.Examples {
[CustomEditor(typeof(Interactable))]
[CanEditMultipleObjects]
public class InteractableEditor : EditorBase {
ReorderableList actions;
static Rect SliceRow (ref Rect rect, float height) {
return GUIUtilityx.SliceRow(ref rect, height);
}
protected override void OnEnable () {
base.OnEnable();
actions = new ReorderableList(serializedObject, serializedObject.FindProperty("actions"), true, true, true, true);
actions.drawElementCallback = (Rect rect, int index, bool active, bool isFocused) => {
var item = actions.serializedProperty.GetArrayElementAtIndex(index);
var ob = item.managedReferenceValue as Interactable.InteractableAction;
if (ob == null) {
EditorGUI.LabelField(rect, "Null");
return;
}
var tp = ob.GetType();
var lineHeight = EditorGUIUtility.singleLineHeight;
if (tp == typeof(Interactable.AnimatorSetBoolAction)) {
EditorGUI.LabelField(SliceRow(ref rect, lineHeight), "Set Animator Property", EditorStyles.boldLabel);
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("animator"));
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("propertyName"));
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("value"));
} else if (tp == typeof(Interactable.AnimatorPlay)) {
EditorGUI.LabelField(SliceRow(ref rect, lineHeight), "Play Animator State", EditorStyles.boldLabel);
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("animator"));
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("stateName"));
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("normalizedTime"));
} else if (tp == typeof(Interactable.ActivateParticleSystem)) {
EditorGUI.LabelField(SliceRow(ref rect, lineHeight), "Activate Particle System", EditorStyles.boldLabel);
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("particleSystem"));
} else if (tp == typeof(Interactable.DelayAction)) {
EditorGUI.LabelField(SliceRow(ref rect, lineHeight), "Delay", EditorStyles.boldLabel);
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("delay"));
} else if (tp == typeof(Interactable.SetObjectActiveAction)) {
EditorGUI.LabelField(SliceRow(ref rect, lineHeight), "Set Object Active", EditorStyles.boldLabel);
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("target"));
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("active"));
} else if (tp == typeof(Interactable.TeleportAgentAction)) {
EditorGUI.LabelField(SliceRow(ref rect, lineHeight), "Teleport Agent", EditorStyles.boldLabel);
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("destination"));
} else if (tp == typeof(Interactable.TeleportAgentOnLinkAction)) {
EditorGUI.LabelField(SliceRow(ref rect, lineHeight), "Teleport Agent on Off-Mesh Link", EditorStyles.boldLabel);
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("destination"));
} else if (tp == typeof(Interactable.SetTransformAction)) {
EditorGUI.LabelField(SliceRow(ref rect, lineHeight), "Set Transform", EditorStyles.boldLabel);
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("transform"));
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("source"));
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("setPosition"));
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("setRotation"));
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("setScale"));
} else if (tp == typeof(Interactable.MoveToAction)) {
EditorGUI.LabelField(SliceRow(ref rect, lineHeight), "Move To", EditorStyles.boldLabel);
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("destination"));
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("useRotation"));
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("waitUntilReached"));
} else if (tp == typeof(Interactable.InstantiatePrefab)) {
EditorGUI.LabelField(SliceRow(ref rect, lineHeight), "Instantiate Prefab", EditorStyles.boldLabel);
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("prefab"));
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("position"));
} else if (tp == typeof(Interactable.CallFunction)) {
EditorGUI.LabelField(SliceRow(ref rect, lineHeight), "Call Function", EditorStyles.boldLabel);
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("function"));
} else if (tp == typeof(Interactable.InteractAction)) {
EditorGUI.LabelField(SliceRow(ref rect, lineHeight), "Interact", EditorStyles.boldLabel);
EditorGUI.PropertyField(SliceRow(ref rect, lineHeight), item.FindPropertyRelative("interactable"));
}
};
actions.elementHeightCallback = (int index) => {
var actions = (target as Interactable).actions;
var tp = index < actions.Count ? actions[index]?.GetType() : null;
var h = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (tp == null) return h;
else if (tp == typeof(Interactable.AnimatorSetBoolAction)) return 4*h;
else if (tp == typeof(Interactable.AnimatorPlay)) return 4*h;
else if (tp == typeof(Interactable.ActivateParticleSystem)) return 2*h;
else if (tp == typeof(Interactable.DelayAction)) return 2*h;
else if (tp == typeof(Interactable.SetObjectActiveAction)) return 3*h;
else if (tp == typeof(Interactable.TeleportAgentAction)) return 2*h;
else if (tp == typeof(Interactable.TeleportAgentOnLinkAction)) return 2*h;
else if (tp == typeof(Interactable.SetTransformAction)) return 6*h;
else if (tp == typeof(Interactable.MoveToAction)) return 4*h;
else if (tp == typeof(Interactable.InstantiatePrefab)) return 3*h;
else if (tp == typeof(Interactable.InteractAction)) return 2*h;
else if (tp == typeof(Interactable.CallFunction)) {
return (3.5f + Mathf.Max(1, (actions[index] as Interactable.CallFunction).function.GetPersistentEventCount())*2.5f) * h;
} else throw new System.Exception("Unexpected type " + tp);
};
actions.drawHeaderCallback = (Rect rect) => {
EditorGUI.LabelField(rect, "Actions");
};
actions.onAddDropdownCallback = (rect, _) => {
GenericMenu menu = new GenericMenu();
var interactable = target as Interactable;
menu.AddItem(new GUIContent("AnimatorSetBool"), false, () => interactable.actions.Add(new Interactable.AnimatorSetBoolAction()));
menu.AddItem(new GUIContent("AnimatorPlay"), false, () => interactable.actions.Add(new Interactable.AnimatorPlay()));
menu.AddItem(new GUIContent("ActivateParticleSystem"), false, () => interactable.actions.Add(new Interactable.ActivateParticleSystem()));
menu.AddItem(new GUIContent("Delay"), false, () => interactable.actions.Add(new Interactable.DelayAction()));
menu.AddItem(new GUIContent("SetObjectActive"), false, () => interactable.actions.Add(new Interactable.SetObjectActiveAction()));
menu.AddItem(new GUIContent("TeleportAgent"), false, () => interactable.actions.Add(new Interactable.TeleportAgentAction()));
if (interactable.TryGetComponent<NodeLink2>(out var _)) {
menu.AddItem(new GUIContent("Teleport Agent on Off-Mesh Link"), false, () => interactable.actions.Add(new Interactable.TeleportAgentOnLinkAction()));
}
menu.AddItem(new GUIContent("SetTransform"), false, () => interactable.actions.Add(new Interactable.SetTransformAction()));
menu.AddItem(new GUIContent("MoveTo"), false, () => interactable.actions.Add(new Interactable.MoveToAction()));
menu.AddItem(new GUIContent("InstantiatePrefab"), false, () => interactable.actions.Add(new Interactable.InstantiatePrefab()));
menu.AddItem(new GUIContent("CallFunction"), false, () => interactable.actions.Add(new Interactable.CallFunction()));
menu.AddItem(new GUIContent("Interact with other interactable"), false, () => interactable.actions.Add(new Interactable.InteractAction()));
menu.DropDown(rect);
};
}
protected override void Inspector () {
var script = target as Interactable;
script.actions = script.actions ?? new List<Interactable.InteractableAction>();
actions.DoLayoutList();
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: ebafa3cffbc5f3d4f90cbca561882b97
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 87744
packageName: A* Pathfinding Project Pro
packageVersion: 5.3.8
assetPath: Packages/com.arongranberg.astar/ExampleScenes~/ExampleScripts/Editor/InteractableEditor.cs
uploadId: 764484