2023-06-05 19:57:17 +08:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using System.Linq;
|
2023-06-29 14:57:11 +08:00
|
|
|
|
2023-06-05 19:57:17 +08:00
|
|
|
using UnityEngine.UIElements;
|
2023-06-29 14:57:11 +08:00
|
|
|
#if UNITY_EDITOR
|
|
|
|
using UnityEditor;
|
|
|
|
#endif
|
2023-06-05 19:57:17 +08:00
|
|
|
namespace BITKit
|
|
|
|
{
|
2023-06-29 14:57:11 +08:00
|
|
|
public abstract class VisualBehaviour:MonoBehaviour
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
public abstract class BITBehavior : MonoBehaviour, ICustomInspector
|
2023-06-05 19:57:17 +08:00
|
|
|
{
|
|
|
|
public VisualTreeAsset customTreeAsset;
|
|
|
|
public virtual void OnAwake() { }
|
|
|
|
public virtual void OnStart() { }
|
|
|
|
public virtual void OnStop() { }
|
|
|
|
public virtual void OnUpdate(float deltaTime) { }
|
|
|
|
public virtual void OnFixedUpdate(float deltaTime) { }
|
|
|
|
public virtual void OnLateUpdate(float deltaTime) { }
|
|
|
|
public virtual void OnDestroyComponent() { }
|
|
|
|
public virtual void SetActive(bool active) { }
|
|
|
|
public virtual Transform GetTransform() => transform;
|
|
|
|
public void Toggle()
|
|
|
|
{
|
|
|
|
enabled = !enabled;
|
|
|
|
}
|
|
|
|
public virtual string GetName()
|
|
|
|
{
|
|
|
|
return gameObject.name;
|
|
|
|
}
|
|
|
|
public virtual object GetDiagnostics()
|
|
|
|
{
|
|
|
|
throw new System.NotImplementedException();
|
|
|
|
}
|
|
|
|
public VisualElement GetVisualElement()
|
|
|
|
{
|
|
|
|
return customTreeAsset ? customTreeAsset.CloneTree() : null;
|
|
|
|
}
|
|
|
|
}
|
2023-06-29 14:57:11 +08:00
|
|
|
#if UNITY_EDITOR
|
|
|
|
[CustomEditor(typeof(VisualBehaviour),true)]
|
|
|
|
public class VisualBehaviourInspector:BITInspector<VisualBehaviour>
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
2023-06-05 19:57:17 +08:00
|
|
|
}
|