|
class_name BaseMenu
|
|
extends ColorRect
|
|
|
|
|
|
@export var animation_player: AnimationPlayer
|
|
|
|
var pause_menu: PauseMenu
|
|
|
|
|
|
func init() -> void:
|
|
reset_menu()
|
|
update_animation_tracks()
|
|
|
|
func close_menu() -> void:
|
|
animation_player.play("hide")
|
|
|
|
func open_menu() -> void:
|
|
animation_player.play("show")
|
|
|
|
func reset_menu() -> void:
|
|
animation_player.play("RESET")
|
|
|
|
## Update the animation tracks to account for the varying sizes of the menu container[br]
|
|
## Requires:[br]
|
|
## Track 1 - Must be for the content_container[br]
|
|
## First Property - Must be position[br]
|
|
## Second Property - Visibility
|
|
func update_animation_tracks() -> void:
|
|
var hide_animation: Animation = animation_player.get_animation("hide")
|
|
var show_animation: Animation = animation_player.get_animation("show")
|
|
|
|
hide_animation.track_set_key_value(0, 1, Vector2(-size.x, hide_animation.track_get_key_value(0, 1).y))
|
|
show_animation.track_set_key_value(0, 0, Vector2(-size.x, show_animation.track_get_key_value(0, 0).y))
|