improve ui and bug fix
This commit is contained in:
@@ -18,6 +18,13 @@ var current_pan: Vector2 = Vector2.ZERO
|
||||
var is_active: bool = false
|
||||
var previous_camera: Camera3D
|
||||
|
||||
@export_group("Isometric Zoom")
|
||||
@export var normal_size : float = 35.0
|
||||
@export var zoom_size : float = 60.0
|
||||
@export var zoom_time : float = 1.2
|
||||
var is_zoomed : bool = false
|
||||
var zoom_tween : Tween
|
||||
|
||||
var initial_local_pos: Vector3
|
||||
var initial_local_basis: Basis
|
||||
|
||||
@@ -28,6 +35,7 @@ func _ready() -> void:
|
||||
GameState.on_enable_photo_mode_request.connect(enable_photo_mode)
|
||||
GameState.on_disable_photo_mode_request.connect(disable_photo_mode)
|
||||
GameState.on_photo_taken_making.connect(take_photo_async)
|
||||
GameState.on_photo_mode_black_screen_disappeared.connect(_on_photo_mode_black_screen_disappeared)
|
||||
|
||||
initial_local_pos = position
|
||||
initial_local_basis = basis
|
||||
@@ -50,6 +58,19 @@ func disable_photo_mode() -> void:
|
||||
previous_camera.make_current()
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventKey and event.pressed and not event.echo:
|
||||
if event.keycode == KEY_Z and camera:
|
||||
is_zoomed = !is_zoomed
|
||||
var target_size = zoom_size if is_zoomed else normal_size
|
||||
|
||||
if zoom_tween and zoom_tween.is_valid():
|
||||
zoom_tween.kill()
|
||||
|
||||
zoom_tween = create_tween()
|
||||
zoom_tween.set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
|
||||
zoom_tween.tween_property(camera, "size", target_size, zoom_time)
|
||||
zoom_tween.parallel().tween_property(camera, "fov", target_size, zoom_time)
|
||||
|
||||
if event.is_action_pressed("toggle_photo_mode"):
|
||||
if not is_active:
|
||||
GameState.on_enable_photo_mode_request.emit()
|
||||
@@ -98,7 +119,7 @@ func take_photo_async() -> void:
|
||||
var targets = get_tree().get_nodes_in_group("collectible")
|
||||
var space_state = get_world_3d().direct_space_state
|
||||
|
||||
await CollectionManager.save_photo_to_disk_async(captured_image)
|
||||
CollectionManager.save_photo_to_disk_async(captured_image)
|
||||
|
||||
for target in targets:
|
||||
if not target.collectible_data:
|
||||
@@ -116,4 +137,6 @@ func take_photo_async() -> void:
|
||||
|
||||
GameState.save_game()
|
||||
GameState.on_photo_taken_finished.emit()
|
||||
|
||||
func _on_photo_mode_black_screen_disappeared() -> void:
|
||||
is_making_photo = false
|
||||
|
||||
Reference in New Issue
Block a user