2025-12-29 11:54:31 +08:00
|
|
|
@abstract
|
|
|
|
|
class_name ComponentBase extends Node
|
|
|
|
|
|
|
|
|
|
@export_category("Component Base Setting")
|
|
|
|
|
@export var component_owner : Node
|
|
|
|
|
|
|
|
|
|
##改变量用来控制组件是否启用
|
|
|
|
|
@export var is_active : bool = true:
|
|
|
|
|
set(value):
|
|
|
|
|
set_physics_process(value)
|
|
|
|
|
set_process(value)
|
|
|
|
|
is_active = value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
|
if not component_owner:
|
|
|
|
|
component_owner = owner
|
|
|
|
|
|
|
|
|
|
#组件在初始化时都会等待character的加载
|
2025-12-31 13:07:31 +08:00
|
|
|
if component_owner and not component_owner.is_node_ready() : await component_owner.ready
|
2025-12-29 11:54:31 +08:00
|
|
|
_init_component()
|
|
|
|
|
|
|
|
|
|
@abstract
|
|
|
|
|
func _init_component() -> void
|