From 8633ed4a9c461f02e01dac07b4ec82a173fbd189 Mon Sep 17 00:00:00 2001 From: Yunasawa Date: Thu, 30 May 2024 18:10:18 +0700 Subject: [PATCH] ... --- Editor/Inspectors/AIRootEditor.cs | 6 +++++- Editor/Resources/Style Sheets/Elements.meta | 8 -------- Main/AIRoot.cs | 19 ++++++++++++++++++- Sample/Sample Scene.unity | 1 + package.json | 2 +- 5 files changed, 25 insertions(+), 11 deletions(-) delete mode 100644 Editor/Resources/Style Sheets/Elements.meta diff --git a/Editor/Inspectors/AIRootEditor.cs b/Editor/Inspectors/AIRootEditor.cs index 1978de5..55990dd 100644 --- a/Editor/Inspectors/AIRootEditor.cs +++ b/Editor/Inspectors/AIRootEditor.cs @@ -1,5 +1,6 @@ #if UNITY_EDITOR && YNL_EDITOR using UnityEditor; +using UnityEditor.UIElements; using UnityEngine.UIElements; using YNL.Editors.UIElements.Flexs; using YNL.Editors.Windows.Utilities; @@ -30,7 +31,10 @@ private void Initialization() .SetGlobalColor("#8FF2FF") .AddIcon("Icons/AI Root", MAddressType.Resources) .AddTitle("AI Root") - .AddDocumentation("https://github.com/Yunasawa-Studio/YNL-Simple-AI-System")); + .AddDocumentation("https://github.com/Yunasawa-Studio/YNL-Simple-AI-System") + .AddBottomSpace(10)); + + InspectorElement.FillDefaultInspector(_root, serializedObject, this); } } } diff --git a/Editor/Resources/Style Sheets/Elements.meta b/Editor/Resources/Style Sheets/Elements.meta deleted file mode 100644 index 4e07a0f..0000000 --- a/Editor/Resources/Style Sheets/Elements.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 86b24e68c96e4744fa8b59df77daeef9 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Main/AIRoot.cs b/Main/AIRoot.cs index b1c5d98..a905d16 100644 --- a/Main/AIRoot.cs +++ b/Main/AIRoot.cs @@ -1,9 +1,26 @@ +#if YNL_UTILITIES using UnityEngine; +using YNL.Extensions.Methods; namespace YNL.SimpleAISystem { public class AIRoot : MonoBehaviour { + public AIController Controller; + #region MonoBehaviour + private void OnValidate() + { + if (Controller.IsNull()) Controller = GetComponentInChildren(); + } + + private void Start() + { + if (Controller.IsNull()) Controller = GetComponentInChildren(); + } + #endregion + + public void EnableAI(bool enable) => Controller.enabled = enable; } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/Sample/Sample Scene.unity b/Sample/Sample Scene.unity index 8a93723..87ed9d9 100644 --- a/Sample/Sample Scene.unity +++ b/Sample/Sample Scene.unity @@ -283,6 +283,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 24069b42bf0820d4fa616b5d8af14df0, type: 3} m_Name: m_EditorClassIdentifier: + Controller: {fileID: 1237137602} --- !u!65 &721477080 BoxCollider: m_ObjectHideFlags: 0 diff --git a/package.json b/package.json index b5a1c1e..89e31b0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ { "name": "com.yunasawa.ynl.simpleaisystem", "displayName": "YNL - Simple AI System", - "version": "1.1.12", + "version": "1.2.1", "unity": "2022.3", "description": "YNL - Simple AI System provides you a simple system to handle objects' behaviours as an AI.", "keywords": [