khanat-client/scenes/interfaces/game_menu/game_ui.gd

48 lines
1.7 KiB
GDScript3
Raw Normal View History

extends Control
func change_douleur( value ):
2021-01-21 21:03:44 +00:00
$stats_window.get_content_child( "douleur" ).value += value
if value > 0.0:
$stats_window.get_content_child( "oubli" ).value -= value/2
func change_oubli( value ):
2021-01-21 21:03:44 +00:00
$stats_window.get_content_child( "oubli" ).value += value
if value > 0.0:
$stats_window.get_content_child( "douleur" ).value -= value/2
func change_trauma( value ):
2021-01-21 21:03:44 +00:00
$stats_window.get_content_child( "trauma" ).self_modulate.a += value/6.0
func set_douleur( value ):
2021-01-21 21:03:44 +00:00
var delta = value - $stats_window.get_content_child( "douleur" ).value
$stats_window.get_content_child( "douleur" ).value = value
if delta > 0.0:
$stats_window.get_content_child( "oubli" ).value -= delta/2
func set_oubli( value ):
2021-01-21 21:03:44 +00:00
var delta = value - $stats_window.get_content_child( "oubli" ).value
$stats_window.get_content_child( "oubli" ).value = value
if delta > 0.0:
$stats_window.get_content_child( "douleur" ).value -= delta/2
func set_trauma( value ):
2021-01-21 21:03:44 +00:00
$stats_window.get_content_child( "trauma" ).self_modulate.a = value/6.0
func update_trauma():
2021-01-21 21:03:44 +00:00
var trauma_value = (($stats_window.get_content_child( "oubli" ).value+$stats_window.get_content_child( "douleur" ).value)/2)
$stats_window.get_content_child( "trauma" ).value = trauma_value
$stats_window.get_content_child( "trauma" ).self_modulate.a = trauma_value/6.0
func _on_douleur_value_changed(value):
2021-01-21 21:03:44 +00:00
$stats_window.get_content_child( "douleur" ).self_modulate.a = (value / 18.0) * (value / 18.0)
self.update_trauma()
func _on_oubli_value_changed(value):
2021-01-21 21:03:44 +00:00
$stats_window.get_content_child( "oubli" ).self_modulate.a = (value / 18.0) * (value / 18.0)
self.update_trauma()
func _on_trauma_value_changed(value):
2021-01-21 21:03:44 +00:00
$stats_window.get_content_child( "trauma" ).self_modulate.a = (value / 6.0)