64 lines
1.5 KiB
C#
64 lines
1.5 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 objName;
|
|
}
|
|
|
|
public override void UpdateComponent()
|
|
{
|
|
base.UpdateComponent();
|
|
outlineComponent = GetComponent<Outline>();
|
|
}
|
|
|
|
public override void Enable(NodeState nodeState)
|
|
{
|
|
if ((nodeState == NodeState.FirstRun) || (nodeState == NodeState.Running))
|
|
{
|
|
outlineComponent.enabled = true;
|
|
Task.SetSucceeded();
|
|
}
|
|
}
|
|
|
|
public override void Disable(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[] {"Enable", $"BTC.Enable(\"{gameObject.name}\")"},
|
|
new string[] {"Disable", $"BTC.Disable(\"{gameObject.name}\")"}
|
|
};
|
|
}
|
|
}
|
|
|
|
public Outline outlineComponent;
|
|
public string objName = "OutlineXY";
|
|
} |