using Thousandto.Core.RootSystem; using Thousandto.Core.Base; using Thousandto.Plugins.Common.UniScene; using System; using System.Collections.Generic; using System.Text; using UnityEngine; using Thousandto.Core.Support; namespace Thousandto.Plugins.PathGrid { /// /// 路标 /// public class Landmark : MonoBehaviour { static Landmark _sharedInstance = null; public float m_size = 0.1f; public static Landmark sharedInstance { get { if ( _sharedInstance == null ) { var go = new GameObject( typeof( Landmark ).Name ); go.transform.parent = AppRoot.Transform; _sharedInstance = go.AddComponent(); } return _sharedInstance; } } List m_points = new List(); public void Clear() { m_points.Clear(); } public void AddPoint( Vector3 pt ) { m_points.Add( pt ); } public void AddPoints(List pts) { pts.ForEach(pt => m_points.Add(pt)); } static int colorIndex = 0; void OnDrawGizmos() { colorIndex = 0; m_points.ForEach( pt => { Gizmos.color = ColorTable.Index(colorIndex); if (colorIndex < m_points.Count - 1) { Gizmos.DrawSphere(pt, m_size); } else { Gizmos.DrawSphere(pt, m_size * 2); } colorIndex++; } ); } } }