From 5525bcd7bc950332c5b07ea4651a9dd9eed95a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Fri, 29 Aug 2025 12:51:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=92=E8=89=B2):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E7=94=9F=E6=88=90=E6=97=B6=E7=9A=84=E8=A1=8C?= =?UTF-8?q?=E8=B5=B0=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在Chick角色和EntityBase基类中添加spawn方法,用于在角色生成时播放行走动画 --- scripts/Contents/Characters/Chick.gd | 2 ++ scripts/Statemachine/EntityBase.gd | 3 +++ 2 files changed, 5 insertions(+) diff --git a/scripts/Contents/Characters/Chick.gd b/scripts/Contents/Characters/Chick.gd index 37afcde..b1f3f68 100644 --- a/scripts/Contents/Characters/Chick.gd +++ b/scripts/Contents/Characters/Chick.gd @@ -11,6 +11,8 @@ func register(): attackCooldownMap[0] = 2000 attackCooldownMap[1] = 6000 attackCooldownMap[2] = 100 +func spawn(): + texture.play("walk") func ai(): move(currentFocusedBoss.position - position) diff --git a/scripts/Statemachine/EntityBase.gd b/scripts/Statemachine/EntityBase.gd index 0b5b333..f3665eb 100644 --- a/scripts/Statemachine/EntityBase.gd +++ b/scripts/Statemachine/EntityBase.gd @@ -106,6 +106,7 @@ func _ready(): ) healthChanged.emit(health) energyChanged.emit(energy) + spawn() func _process(_delta): health = clamp(health, 0, fields.get(FieldStore.Entity.MAX_HEALTH)) energy = clamp(energy, 0, fields.get(FieldStore.Entity.MAX_ENERGY)) @@ -256,6 +257,8 @@ func heal(count: float): return count func register(): pass +func spawn(): + pass static func generate( entity: PackedScene,