|
@@ -22,17 +22,29 @@ signal ended
|
|
|
var tween: Tween
|
|
|
var scope: Vector2 : get = get_scope, set = set_scope
|
|
|
|
|
|
+var target_pos: Vector2 = Vector2.ZERO
|
|
|
+var target_scope: Vector2 = Vector2.ONE
|
|
|
+
|
|
|
|
|
|
func focus_on(pos: Vector2, scalar_scale: float) -> void:
|
|
|
+ target_pos = pos
|
|
|
+ target_scope = Vector2.ONE * scalar_scale
|
|
|
+
|
|
|
+
|
|
|
+func beam_to_focus() -> void:
|
|
|
+ set_position(target_pos)
|
|
|
+ set_scope(target_scope)
|
|
|
+
|
|
|
+
|
|
|
+func transit_to_focus() -> void:
|
|
|
if tween:
|
|
|
tween.kill()
|
|
|
|
|
|
- var target_scope = Vector2.ONE * scalar_scale
|
|
|
var is_wider = target_scope.x > get_scope().x
|
|
|
var scope_ease = scope_wider_ease if is_wider else scope_closer_ease
|
|
|
|
|
|
tween = create_tween().set_parallel(tween_is_parallel)
|
|
|
- tween.tween_property(self, "position", pos, move_duration).set_trans(move_trans).set_ease(move_ease)
|
|
|
+ tween.tween_property(self, "position", target_pos, move_duration).set_trans(move_trans).set_ease(move_ease)
|
|
|
tween.tween_property(self, "scope", target_scope, scope_duration).set_trans(scope_trans).set_ease(scope_ease)
|
|
|
tween.tween_callback(end)
|
|
|
|
|
@@ -57,3 +69,11 @@ func _on_show_new_focus(pos: Vector2, scalar_scale: float) -> void:
|
|
|
|
|
|
func _invert_vector(vec: Vector2) -> Vector2:
|
|
|
return Vector2(1.0 / vec.x, 1.0 / vec.y)
|
|
|
+
|
|
|
+
|
|
|
+func _on_show_fast_move():
|
|
|
+ beam_to_focus()
|
|
|
+
|
|
|
+
|
|
|
+func _on_show_slow_move():
|
|
|
+ transit_to_focus()
|