67 lines
1.7 KiB
C#
67 lines
1.7 KiB
C#
|
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
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 路标
|
|||
|
/// </summary>
|
|||
|
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<Landmark>();
|
|||
|
}
|
|||
|
return _sharedInstance;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
List<Vector3> m_points = new List<Vector3>();
|
|||
|
|
|||
|
public void Clear() {
|
|||
|
m_points.Clear();
|
|||
|
}
|
|||
|
|
|||
|
public void AddPoint( Vector3 pt ) {
|
|||
|
m_points.Add( pt );
|
|||
|
}
|
|||
|
|
|||
|
public void AddPoints(List<Vector3> 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++;
|
|||
|
}
|
|||
|
);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|