mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 15:01:53 +08:00
36bdd8fc27
- 降低核弹基础伤害但提高升级后伤害 - 修改爆炸半径范围描述 - 为核弹爆炸添加随时间递减的屏幕震动效果 - 重构CameraManager的shake方法以支持自定义震动曲线
29 lines
935 B
GDScript
29 lines
935 B
GDScript
@tool
|
|
extends Camera2D
|
|
class_name CameraManager
|
|
|
|
@onready var animator: AnimationPlayer = $"%animator"
|
|
|
|
var shakeIntensity: float = 0
|
|
|
|
static var instance: CameraManager = null
|
|
|
|
func _ready():
|
|
instance = self
|
|
func _physics_process(_delta):
|
|
if is_instance_valid(UIState.player):
|
|
position = UIState.player.position
|
|
position += MathTool.randv2_range(shakeIntensity)
|
|
|
|
static func shake(millseconds: float, intensity: float = 10, steper: Callable = func(currentValue, _totalValue, _restPercent): return currentValue):
|
|
var startTime = WorldManager.getTime()
|
|
instance.shakeIntensity = intensity
|
|
await TickTool.until(
|
|
func():
|
|
instance.shakeIntensity = steper.call(instance.shakeIntensity, intensity, 1 - (WorldManager.getTime() - startTime) / millseconds)
|
|
return WorldManager.getTime() - startTime >= millseconds
|
|
)
|
|
instance.shakeIntensity = 0
|
|
static func playAnimation(animation: String):
|
|
instance.animator.play(animation)
|