mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-31 08:21:54 +08:00
feat: 添加新的角色Hen,更新Chick角色的攻击逻辑,增强Boss状态条和子弹功能
This commit is contained in:
@@ -6,6 +6,6 @@ class_name BossBar
|
||||
|
||||
func _process(delta):
|
||||
super._process(delta)
|
||||
if entity:
|
||||
if is_instance_valid(entity):
|
||||
nameLabel.text = entity.displayName
|
||||
valueLabel.text = "%.2f" % (entity.health / entity.fields[FieldStore.Entity.MAX_HEALTH] * 100)
|
||||
|
||||
@@ -31,7 +31,7 @@ func hit(target: Node):
|
||||
var entity: EntityBase = EntityTool.fromHurtbox(target)
|
||||
if !entity || !launcher: return
|
||||
if entity == launcher: return
|
||||
if GameRule.allowFriendlyFire:
|
||||
if !GameRule.allowFriendlyFire:
|
||||
if entity.isPlayer() == launcher.isPlayer(): return
|
||||
entity.takeDamage(self, MathTool.rate(launcher.fields.get(FieldStore.Entity.CRIT_RATE)))
|
||||
if !MathTool.rate(fullPenerate()):
|
||||
|
||||
@@ -30,6 +30,8 @@ var sprinting: bool = false
|
||||
func _ready():
|
||||
health = fields.get(FieldStore.Entity.MAX_HEALTH)
|
||||
statebar.visible = !isBoss
|
||||
if !isPlayer():
|
||||
currentFocusedBoss = get_tree().get_nodes_in_group("players")[0]
|
||||
func _process(_delta):
|
||||
health = clamp(health, 0, fields.get(FieldStore.Entity.MAX_HEALTH))
|
||||
animatree.set("parameters/blend_position", lerpf(animatree.get("parameters/blend_position"), lastDirection, 0.1))
|
||||
@@ -40,7 +42,8 @@ func _physics_process(_delta: float) -> void:
|
||||
sprinting = false
|
||||
else:
|
||||
velocity = Vector2.ZERO
|
||||
ai()
|
||||
if isPlayer() or is_instance_valid(currentFocusedBoss):
|
||||
ai()
|
||||
move_and_slide()
|
||||
|
||||
# 通用方法
|
||||
@@ -70,8 +73,10 @@ func startCooldown():
|
||||
lastAttack = Time.get_ticks_msec()
|
||||
return state
|
||||
func tryAttack(type: int):
|
||||
if startCooldown():
|
||||
var state = startCooldown()
|
||||
if state:
|
||||
attack(type)
|
||||
return state
|
||||
func trySprint():
|
||||
sprint()
|
||||
sprinting = true
|
||||
|
||||
@@ -6,6 +6,6 @@ class_name EntityStateBar
|
||||
@onready var healthBar: ColorBar = $"%health"
|
||||
|
||||
func _process(_delta):
|
||||
if entity:
|
||||
if is_instance_valid(entity):
|
||||
healthBar.maxValue = entity.fields.get(FieldStore.Entity.MAX_HEALTH)
|
||||
healthBar.setCurrent(entity.health)
|
||||
|
||||
Reference in New Issue
Block a user