UP-Viagg-io/Viagg-io/Assets/Packages/MyBT/BTC/Handlers/NamedOutline.cs

63 lines
1.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MyBT;
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor(typeof(NamedOutline))]
public class NamedOutlineInspector : ComponentHandlerInspector
{
}
#endif
public class NamedOutline : ComponentHandler
{
public override string TypeLabel()
{
return "NamedOutline";
}
public override string ContentLabel()
{
UpdateComponent();
return "";
}
public override void UpdateComponent()
{
base.UpdateComponent();
outlineComponent = GetComponent<Outline>();
}
public override void Show(MyBT.NodeState nodeState)
{
if ((nodeState == NodeState.FirstRun) || (nodeState == NodeState.Running))
{
outlineComponent.enabled = true;
Task.SetSucceeded();
}
}
public override void Hide(MyBT.NodeState nodeState)
{
if ((nodeState == NodeState.FirstRun) || (nodeState == NodeState.Running))
{
outlineComponent.enabled = false;
Task.SetSucceeded();
}
}
public override string[][] helpText
{
get
{
return new string[][] {
new string[] {"Show", $"BTC.Show(\"{gameObject.name}\")"},
new string[] {"Hide", $"BTC.Hide(\"{gameObject.name}\")"}
};
}
}
public Outline outlineComponent;
}