89 lines
2.2 KiB
C#
89 lines
2.2 KiB
C#
//============= Copyright (c) Ludic GmbH, All rights reserved. ==============
|
|
//
|
|
// Purpose: Part of the My Behaviour Tree Controller Code
|
|
//
|
|
//=============================================================================
|
|
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using MyBT;
|
|
|
|
#if UNITY_EDITOR
|
|
using UnityEditor;
|
|
[CustomEditor(typeof(NamedCollider))]
|
|
public class NamedColliderInspector : ComponentHandlerInspector {
|
|
}
|
|
#endif
|
|
|
|
[System.Serializable]
|
|
public class NamedCollider : ComponentHandler {
|
|
public override string TypeLabel () {
|
|
return "Collider";
|
|
}
|
|
|
|
public override string ContentLabel() {
|
|
UpdateComponent();
|
|
return "";
|
|
}
|
|
|
|
public override void UpdateComponent() {
|
|
base.UpdateComponent();
|
|
colliderComponent = GetComponent<Collider>();
|
|
}
|
|
|
|
public Collider colliderComponent;
|
|
|
|
public override string titleText {
|
|
get {
|
|
return "Show/Hide: Enable/Disable Collider";
|
|
}
|
|
}
|
|
|
|
public override string[][] helpText {
|
|
get {
|
|
return new string[][] {
|
|
new string[] {"Show", null, $"BTC.Show(\"{roomId}\", \"{gameObject.name}\")"},
|
|
new string[] {"Hide", null, $"BTC.Hide(\"{roomId}\", \"{gameObject.name}\")"}
|
|
};
|
|
}
|
|
}
|
|
|
|
public override void Show (MyBT.NodeState nodeState) {
|
|
// whan aborting
|
|
if (nodeState == NodeState.Aborting) {
|
|
return;
|
|
}
|
|
|
|
// at start
|
|
if (nodeState == NodeState.FirstRun) {
|
|
// reset event trigger
|
|
colliderComponent.enabled = true;
|
|
Task.SetSucceeded();
|
|
}
|
|
|
|
// during runtime
|
|
if (nodeState == NodeState.Running) {
|
|
}
|
|
}
|
|
|
|
public override void Hide (MyBT.NodeState nodeState) {
|
|
// whan aborting
|
|
if (nodeState == NodeState.Aborting) {
|
|
return;
|
|
}
|
|
|
|
// at start
|
|
if (nodeState == NodeState.FirstRun) {
|
|
// reset event trigger
|
|
colliderComponent.enabled = false;
|
|
Task.SetSucceeded();
|
|
}
|
|
|
|
// during runtime
|
|
if (nodeState == NodeState.Running) {
|
|
}
|
|
}
|
|
}
|