12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityFx.Outline;
- public class HighLightManager : MonoBehaviour
- {
- static OutlineLayerCollection layerCollection;
- private static HighLightManager instance = null;
- public static HighLightManager Instance
- {
- get
- {
- if (instance == null)
- {
- GameObject go = new GameObject("HightlightMananger");
- DontDestroyOnLoad(go);
- instance = go.AddComponent<HighLightManager>();
- layerCollection = Resources.Load<OutlineLayerCollection>("OutlineLayerCollection");
- }
- return instance;
- }
- }
- ///// <summary>
- ///// 测试使用
- ///// </summary>
- //[RuntimeInitializeOnLoadMethod]
- //private static void Test()
- //{
- // Instance.ControllerHighLight(GameObject.Find("Cube"), true);
- //}
- private void OnApplicationQuit()
- {
- layerCollection?.ClearLayerContent();
- }
- public void ControllerHighLight(GameObject go, bool value)
- {
- if (value)
- layerCollection.GetOrAddLayer(0).Add(go);
- else
- layerCollection.GetOrAddLayer(0).Remove(go);
- }
- }
|