From 8722a9920c1f6119bf6e769cba270e63097f8e25 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Thu, 23 May 2024 10:08:29 +0800 Subject: + astar project --- .../Drawing/MonoBehaviourGizmos.cs | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/MonoBehaviourGizmos.cs (limited to 'Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/MonoBehaviourGizmos.cs') diff --git a/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/MonoBehaviourGizmos.cs b/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/MonoBehaviourGizmos.cs new file mode 100644 index 0000000..5019118 --- /dev/null +++ b/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/MonoBehaviourGizmos.cs @@ -0,0 +1,40 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Pathfinding.Drawing { + /// + /// Inherit from this class to draw gizmos. + /// See: getstarted (view in online documentation for working links) + /// + public abstract class MonoBehaviourGizmos : MonoBehaviour, IDrawGizmos { + public MonoBehaviourGizmos() { +#if UNITY_EDITOR + DrawingManager.Register(this); +#endif + } + + /// + /// An empty OnDrawGizmosSelected method. + /// Why an empty OnDrawGizmosSelected method? + /// This is because only objects with an OnDrawGizmos/OnDrawGizmosSelected method will show up in Unity's menu for enabling/disabling + /// the gizmos per object type (upper right corner of the scene view). So we need it here even though we don't use normal gizmos. + /// + /// By using OnDrawGizmosSelected instead of OnDrawGizmos we minimize the overhead of Unity calling this empty method. + /// + void OnDrawGizmosSelected () { + } + + /// + /// Draw gizmos for this object. + /// + /// The gizmos will be visible in the scene view, and the game view, if gizmos have been enabled. + /// + /// This method will only be called in the Unity Editor. + /// + /// See: \ref{Draw} + /// + public virtual void DrawGizmos () { + } + } +} -- cgit v1.1-26-g67d0