using System.Collections; using System.Collections.Generic; using UnityEngine; using Sirenix.OdinInspector; #if UNITY_EDITOR using UnityEditor; #endif using System.Linq; using HighlightingSystem; public class MoveItem : MonoBehaviour { [LabelText("相对方向")] public Vector3 m_Direction = new Vector3(0, 0, 0); /// /// 使用世界坐标方向 /// public bool m_UserGlobalDirection; [LabelText("运行时长")] public float m_Duration; public void OpenHighter(bool open) { HighlightingSystem.Highlighter highlighter = GetComponent() == null ? gameObject.AddComponent() : GetComponent(); if (open) { highlighter.ConstantOn(); }else { Destroy(highlighter); } } #if UNITY_EDITOR private void OnDrawGizmos() { DrawPathLine(); } public void DrawPathLine() { if (Selection.gameObjects.Contains(this.gameObject)) { Gizmos.color = Color.yellow; if (m_UserGlobalDirection) { Gizmos.DrawLine(transform.position, transform.position + m_Direction); } else { Gizmos.DrawLine(transform.position, transform.position + transform.TransformDirection(m_Direction)); } } } #endif }