modification de la scène de cockpit et ajout de lien entre les scènes
This commit is contained in:
22
gui/game/objective_progress_bar/scripts/gauge_3d.gd
Normal file
22
gui/game/objective_progress_bar/scripts/gauge_3d.gd
Normal file
@@ -0,0 +1,22 @@
|
||||
@tool
|
||||
extends Node3D
|
||||
class_name Gauge3D
|
||||
|
||||
const MAX_PROGRESS_BAR_SCALE = 4.25
|
||||
const CYLINDER_HEIGHT = 4.8
|
||||
|
||||
@export var progress := 0. : set = set_progress
|
||||
|
||||
func _ready():
|
||||
if progress != null:
|
||||
%ProgressBar.scale.x = progress * MAX_PROGRESS_BAR_SCALE
|
||||
|
||||
|
||||
func set_progress(_progress : float):
|
||||
progress = _progress
|
||||
if is_node_ready() and progress != null:
|
||||
var capped_progress = max(0.,min(1., progress))
|
||||
%ProgressBar3D.scale.y = capped_progress * %ProgressBar3D.scale.x
|
||||
var bar_length = CYLINDER_HEIGHT
|
||||
%ProgressBar3D.position.z = - bar_length * capped_progress + bar_length
|
||||
# %ProgressBar.scale.x = max(0.,min(1., progress)) * MAX_PROGRESS_BAR_SCALE
|
||||
Reference in New Issue
Block a user