modification de la scène de cockpit et ajout de lien entre les scènes
This commit is contained in:
44
gui/game/objective_progress_bar/gauge_3d.tscn
Normal file
44
gui/game/objective_progress_bar/gauge_3d.tscn
Normal file
@@ -0,0 +1,44 @@
|
||||
[gd_scene format=3 uid="uid://by45bbbnf0k13"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cbf2005eqe2aj" path="res://gui/game/objective_progress_bar/scripts/gauge_3d.gd" id="1_d3qsk"]
|
||||
[ext_resource type="PackedScene" uid="uid://cam5igcebfvsd" path="res://gui/game/objective_progress_bar/assets/3d/gauge.blend" id="2_74wpt"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_vk2vv"]
|
||||
colors = PackedColorArray(1, 0, 0.43137255, 1, 1, 0.6509804, 0.09019608, 1)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_7sip7"]
|
||||
gradient = SubResource("Gradient_vk2vv")
|
||||
|
||||
[sub_resource type="CylinderMesh" id="CylinderMesh_d3qsk"]
|
||||
height = 4.8
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_74wpt"]
|
||||
offsets = PackedFloat32Array(0, 0.38308457, 1)
|
||||
colors = PackedColorArray(1, 0.6509804, 0.09019608, 1, 1, 0.40159988, 0.22089553, 1, 1, 0, 0.43137255, 1)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_figjt"]
|
||||
gradient = SubResource("Gradient_74wpt")
|
||||
fill_to = Vector2(0, 1)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_fjj83"]
|
||||
shading_mode = 0
|
||||
albedo_texture = SubResource("GradientTexture2D_figjt")
|
||||
|
||||
[node name="Gauge3D" type="Node3D" unique_id=232507348]
|
||||
script = ExtResource("1_d3qsk")
|
||||
progress = 1.675
|
||||
|
||||
[node name="Model" parent="." unique_id=1195456570 instance=ExtResource("2_74wpt")]
|
||||
|
||||
[node name="ProgressBar" type="Sprite3D" parent="." unique_id=159202262]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(-1.13321775e-07, 0, 0.989, 0, 200, 0, -2.5925, 0, -4.3230564e-08, 0.27917147, -1.0458755, 5.3935585)
|
||||
visible = false
|
||||
centered = false
|
||||
texture = SubResource("GradientTexture1D_7sip7")
|
||||
|
||||
[node name="ProgressBar3D" type="MeshInstance3D" parent="." unique_id=1654530777]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(2, 0, 0, 0, -8.742278e-08, 2, 0, -2, -8.742278e-08, -0.14886618, 0, 0)
|
||||
mesh = SubResource("CylinderMesh_d3qsk")
|
||||
surface_material_override/0 = SubResource("StandardMaterial3D_fjj83")
|
||||
@@ -4,8 +4,8 @@
|
||||
[ext_resource type="Script" uid="uid://brqgqwh5uwksh" path="res://gui/game/objective_progress_bar/scripts/objective_progress_bar.gd" id="1_wl86c"]
|
||||
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="2_vk2vv"]
|
||||
[ext_resource type="Environment" uid="uid://bxyp24f85p0xf" path="res://gui/game/assets/gui_3d_environment.tres" id="2_wl86c"]
|
||||
[ext_resource type="PackedScene" uid="uid://cam5igcebfvsd" path="res://gui/game/objective_progress_bar/assets/3d/gauge.blend" id="3_3aubw"]
|
||||
[ext_resource type="Texture2D" uid="uid://bt3g5bmar0icf" path="res://common/icons/growth.svg" id="3_7sip7"]
|
||||
[ext_resource type="PackedScene" uid="uid://by45bbbnf0k13" path="res://gui/game/objective_progress_bar/gauge_3d.tscn" id="6_vk2vv"]
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_3aubw"]
|
||||
viewport_path = NodePath("ProgressBarViewPort")
|
||||
@@ -13,12 +13,6 @@ viewport_path = NodePath("ProgressBarViewPort")
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_vk2vv"]
|
||||
size = Vector2(2, 2)
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_vk2vv"]
|
||||
colors = PackedColorArray(1, 0, 0.43137255, 1, 1, 0.6509804, 0.09019608, 1)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_7sip7"]
|
||||
gradient = SubResource("Gradient_vk2vv")
|
||||
|
||||
[node name="ObjectiveProgressBar" type="MarginContainer" unique_id=2043451865]
|
||||
offset_right = 300.0
|
||||
offset_bottom = 75.0
|
||||
@@ -29,7 +23,7 @@ theme_override_constants/margin_top = 0
|
||||
theme_override_constants/margin_right = 0
|
||||
theme_override_constants/margin_bottom = 0
|
||||
script = ExtResource("1_wl86c")
|
||||
progress = 0.815
|
||||
progress = -1.35
|
||||
text = "0/5"
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="." unique_id=1998625871]
|
||||
@@ -65,7 +59,6 @@ expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="ProgressBarViewPort" type="SubViewport" parent="." unique_id=459282221]
|
||||
own_world_3d = true
|
||||
transparent_bg = true
|
||||
size = Vector2i(479, 117)
|
||||
|
||||
@@ -83,10 +76,6 @@ surface_material_override/0 = ExtResource("1_j2f28")
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="ProgressBarViewPort" unique_id=1743124302]
|
||||
environment = ExtResource("2_wl86c")
|
||||
|
||||
[node name="gauge" parent="ProgressBarViewPort" unique_id=1465667654 instance=ExtResource("3_3aubw")]
|
||||
|
||||
[node name="ProgressBar" type="Sprite3D" parent="ProgressBarViewPort" unique_id=1289085425]
|
||||
[node name="Gauge3D" parent="ProgressBarViewPort" unique_id=232507348 instance=ExtResource("6_vk2vv")]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(-1.5140532e-07, 0, 0.989, 0, 200, 0, -3.46375, 0, -4.3230564e-08, 0.27917147, -1.0458755, 5.3935585)
|
||||
centered = false
|
||||
texture = SubResource("GradientTexture1D_7sip7")
|
||||
progress = -1.35
|
||||
|
||||
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
|
||||
1
gui/game/objective_progress_bar/scripts/gauge_3d.gd.uid
Normal file
1
gui/game/objective_progress_bar/scripts/gauge_3d.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cbf2005eqe2aj
|
||||
@@ -1,11 +1,12 @@
|
||||
@tool
|
||||
extends MarginContainer
|
||||
class_name ObjectivProgressBar
|
||||
class_name ObjectiveProgressBar
|
||||
|
||||
const MAX_PROGRESS_BAR_SCALE = 4.25
|
||||
const PROGRESS_BAR_WEIGHT = 0.1
|
||||
|
||||
@export var progress := 0. : set = set_progress
|
||||
@export var progress := 0. :
|
||||
set(v):
|
||||
progress = v
|
||||
if is_node_ready():
|
||||
%Gauge3D.progress = v
|
||||
@export var text := "" :
|
||||
set(v):
|
||||
text = v
|
||||
@@ -13,12 +14,5 @@ const PROGRESS_BAR_WEIGHT = 0.1
|
||||
%ProgressText.text = v
|
||||
|
||||
func _ready():
|
||||
if progress != null:
|
||||
%ProgressBar.scale.x = progress * MAX_PROGRESS_BAR_SCALE
|
||||
%ProgressText.text = text
|
||||
|
||||
|
||||
func set_progress(_progress : float):
|
||||
progress = _progress
|
||||
if is_node_ready() and progress != null:
|
||||
%ProgressBar.scale.x = min(1., progress) * MAX_PROGRESS_BAR_SCALE
|
||||
%Gauge3D.progress = progress
|
||||
|
||||
Reference in New Issue
Block a user