46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using HighlightPlus;
|
|
|
|
using UnityEngine;
|
|
|
|
namespace PMaker.HighlightPlus
|
|
{
|
|
public static class GameObjectExtension
|
|
{
|
|
public static HighlightProfile profile;
|
|
|
|
static GameObjectExtension()
|
|
{
|
|
profile = Resources.Load<HighlightProfile>("Highlight Plus Profile");
|
|
}
|
|
|
|
public static void OnHightlight(this GameObject go,bool ignoreObjectVisibility = false)
|
|
{
|
|
if (go.TryGetComponent<HighlightEffect>(out var highlightEffect) != true)
|
|
{
|
|
highlightEffect = go.AddComponent<HighlightEffect>();
|
|
highlightEffect.ProfileLoad(profile);
|
|
}
|
|
highlightEffect.highlighted = true;
|
|
highlightEffect.ignoreObjectVisibility = ignoreObjectVisibility;
|
|
}
|
|
|
|
public static void OffHightlight(this GameObject go)
|
|
{
|
|
if (go.TryGetComponent<HighlightEffect>(out var highlightEffect))
|
|
{
|
|
highlightEffect.highlighted = false;
|
|
}
|
|
}
|
|
|
|
public static void SetHightlight(this GameObject go, bool value)
|
|
{
|
|
if (go.TryGetComponent<HighlightEffect>(out var highlightEffect) != true)
|
|
{
|
|
highlightEffect = go.AddComponent<HighlightEffect>();
|
|
highlightEffect.ProfileLoad(profile);
|
|
}
|
|
highlightEffect.highlighted = value;
|
|
}
|
|
}
|
|
}
|