mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(BulletBase): 添加自动销毁动画功能
为子弹基类添加 autoDestroyAnimation 导出变量,当设置为 true 时会在销毁时播放销毁动画
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://crtdkysmnkith"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://crtdkysmnkith"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Statemachine/BulletBase.gd" id="1_pklpq"]
|
||||
|
||||
@@ -24,8 +24,14 @@ tracks/0/keys = {
|
||||
[sub_resource type="Animation" id="Animation_kmogx"]
|
||||
resource_name = "spawn"
|
||||
|
||||
[sub_resource type="Animation" id="Animation_oinqg"]
|
||||
resource_name = "destroy"
|
||||
length = 0.5
|
||||
step = 0.1
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_dxweq"]
|
||||
_data = {
|
||||
"destroy": SubResource("Animation_oinqg"),
|
||||
"loop": SubResource("Animation_ynxlt"),
|
||||
"spawn": SubResource("Animation_kmogx")
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ class_name BulletBase
|
||||
@export var needEnergy: float = 0.0 # 发射时需要消耗的能量
|
||||
@export var autoSpawnAnimation: bool = false
|
||||
@export var autoLoopAnimation: bool = false
|
||||
@export var autoDestroyAnimation: bool = false
|
||||
@export var freeAfterSpawn: bool = false
|
||||
@export var knockback: float = 0 # 击退力,物理引擎单位
|
||||
@export var recoil: float = 0 # 后坐力,物理引擎单位
|
||||
@@ -74,6 +75,9 @@ func dotLoop():
|
||||
func ai():
|
||||
pass
|
||||
func destroy():
|
||||
if autoDestroyAnimation:
|
||||
animator.play("destroy")
|
||||
await animator.animation_finished
|
||||
queue_free()
|
||||
func spawn():
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user