From a5c191cf74238084d9bd9f805b4b6755f70d956d Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 1 Sep 2021 08:30:42 +0800 Subject: =?UTF-8?q?*=E6=94=B9=E5=8F=98=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Unit/Components/UnitComponent.cs | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Assets/Scripts/Unit/Components/UnitComponent.cs (limited to 'Assets/Scripts/Unit/Components/UnitComponent.cs') diff --git a/Assets/Scripts/Unit/Components/UnitComponent.cs b/Assets/Scripts/Unit/Components/UnitComponent.cs new file mode 100644 index 00000000..a5034581 --- /dev/null +++ b/Assets/Scripts/Unit/Components/UnitComponent.cs @@ -0,0 +1,42 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class UnitComponent : MonoBehaviour +{ + public UnitController owner { get { return m_Owner; } } + + protected UnitController m_Owner; + + public bool IsAlive + { + get + { + return m_Owner != null; + } + } + + public virtual void Awake() + { + } + + public virtual void OnDestroy() + { + } + + public virtual void Initialize() + { + m_Owner = GetComponent(); + } + + public virtual void Release() + { + m_Owner = null; + StopAllCoroutines(); + } + + public virtual void OnUpdate() { } + + private void Update() { } + +} -- cgit v1.1-26-g67d0