|
|
|
|
@ -13,7 +13,7 @@ class Trans:
|
|
|
|
|
var trigger_name: StringName
|
|
|
|
|
var on_end: bool
|
|
|
|
|
|
|
|
|
|
var trans_list: Array[Trans] = []
|
|
|
|
|
var trans_dict: Dictionary = {}
|
|
|
|
|
var move_sprite_frames: SpriteFrames
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -69,9 +69,8 @@ func _ready():
|
|
|
|
|
run("rebound", "airhit2_loop")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _process(delta) -> void:
|
|
|
|
|
func _process(_delta) -> void:
|
|
|
|
|
tick_view()
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func tick_view() -> void:
|
|
|
|
|
@ -131,30 +130,36 @@ func _add_trans(from: StringName, to: StringName, condition, compareType, condit
|
|
|
|
|
new_trans.to = to
|
|
|
|
|
new_trans.trigger_name = trigger_name
|
|
|
|
|
new_trans.on_end = on_end
|
|
|
|
|
trans_list.append(new_trans)
|
|
|
|
|
if not from in trans_dict:
|
|
|
|
|
trans_dict[from] = []
|
|
|
|
|
trans_dict[from].append(new_trans)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func update_trans(on_end: bool):
|
|
|
|
|
for trans in trans_list:
|
|
|
|
|
if on_end != trans.on_end:
|
|
|
|
|
continue
|
|
|
|
|
if not ((trans.from == "any") or (trans.from == animation)):
|
|
|
|
|
if not update_trans_by_from("any", on_end):
|
|
|
|
|
update_trans_by_from(animation, on_end)
|
|
|
|
|
|
|
|
|
|
func update_trans_by_from(from: String, on_end: bool) -> bool:
|
|
|
|
|
if not from in trans_dict:
|
|
|
|
|
return false
|
|
|
|
|
for trans_single in trans_dict[from]:
|
|
|
|
|
if on_end != trans_single.on_end:
|
|
|
|
|
continue
|
|
|
|
|
if trans.condition != "":
|
|
|
|
|
var conditionValue = status.get(trans.condition)
|
|
|
|
|
match trans.compareType:
|
|
|
|
|
">": if conditionValue <= trans.conditionValue: continue
|
|
|
|
|
"<": if conditionValue >= trans.conditionValue: continue
|
|
|
|
|
">=": if conditionValue < trans.conditionValue: continue
|
|
|
|
|
"<=": if conditionValue > trans.conditionValue: continue
|
|
|
|
|
"=": if conditionValue != trans.conditionValue: continue
|
|
|
|
|
if trans.trigger_name != "":
|
|
|
|
|
if status.get(trans.trigger_name):
|
|
|
|
|
status.set(trans.trigger_name, false)
|
|
|
|
|
if trans_single.condition != "":
|
|
|
|
|
var conditionValue = status.get(trans_single.condition)
|
|
|
|
|
match trans_single.compareType:
|
|
|
|
|
">": if conditionValue <= trans_single.conditionValue: continue
|
|
|
|
|
"<": if conditionValue >= trans_single.conditionValue: continue
|
|
|
|
|
">=": if conditionValue < trans_single.conditionValue: continue
|
|
|
|
|
"<=": if conditionValue > trans_single.conditionValue: continue
|
|
|
|
|
"=": if conditionValue != trans_single.conditionValue: continue
|
|
|
|
|
if trans_single.trigger_name != "":
|
|
|
|
|
if status.get(trans_single.trigger_name):
|
|
|
|
|
status.set(trans_single.trigger_name, false)
|
|
|
|
|
else: continue
|
|
|
|
|
play_animation(trans.to)
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
play_animation(trans_single.to)
|
|
|
|
|
return true
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
|
|
func update_flip():
|
|
|
|
|
scale.x = 1 if status.is_right else -1
|
|
|
|
|
@ -179,10 +184,10 @@ func update_material() -> void:
|
|
|
|
|
func _update_material():
|
|
|
|
|
if not sprite_frames:
|
|
|
|
|
return
|
|
|
|
|
var material: ShaderMaterial = material_override as ShaderMaterial
|
|
|
|
|
var material: ShaderMaterial = material_override as ShaderMaterial
|
|
|
|
|
var material2: ShaderMaterial = material_override.next_pass as ShaderMaterial
|
|
|
|
|
var tex: Texture2D = sprite_frames.get_frame_texture(animation, frame)
|
|
|
|
|
var deformation_rate: float = status.deformation_rate * (0.5 if status.is_floating else 0.4)
|
|
|
|
|
var tex: Texture2D = sprite_frames.get_frame_texture(animation, frame)
|
|
|
|
|
var deformation_rate: float = status.deformation_rate * (0.5 if status.is_floating else 0.4)
|
|
|
|
|
if material:
|
|
|
|
|
material.set_shader_parameter("flash_white", status.flash_white_rate)
|
|
|
|
|
material.set_shader_parameter("deformation_dir", status.deformation_dir)
|
|
|
|
|
|