#59 ajout de la mention de si l'action prends de l'énergie ou non

This commit is contained in:
Zacharie Guet 2025-09-05 17:01:20 +02:00
parent 2dc365736f
commit 165a4d129b
2 changed files with 15 additions and 2 deletions

View File

@ -1,9 +1,10 @@
[gd_scene load_steps=6 format=3 uid="uid://0yr6b2jtuttm"]
[gd_scene load_steps=7 format=3 uid="uid://0yr6b2jtuttm"]
[ext_resource type="Script" uid="uid://vhumsfntpqcl" path="res://gui/pointer/scripts/pointer.gd" id="1_1pe2k"]
[ext_resource type="Texture2D" uid="uid://bspffyprdywgc" path="res://gui/pointer/assets/cursors/pointer.svg" id="2_q4bvb"]
[ext_resource type="AudioStream" uid="uid://bym03qp4n6vep" path="res://gui/pointer/assets/sounds/click.wav" id="3_kj0cm"]
[ext_resource type="Texture2D" uid="uid://djb52fosgmv4j" path="res://gui/pointer/assets/icons/left_click.svg" id="3_pshoq"]
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://gui/game/assets/icons/bolt.svg" id="4_b4uwv"]
[ext_resource type="Script" uid="uid://c2en2hc6a7ils" path="res://gui/pointer/scripts/action_zone.gd" id="4_pshoq"]
[node name="Pointer" type="Node"]
@ -42,10 +43,15 @@ unique_name_in_owner = true
modulate = Color(1, 1, 0.168627, 1)
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="CanvasLayer/Inspector/Container/Action"]
[node name="MouseImage" type="TextureRect" parent="CanvasLayer/Inspector/Container/Action"]
layout_mode = 2
texture = ExtResource("3_pshoq")
[node name="ActionEnergyImage" type="TextureRect" parent="CanvasLayer/Inspector/Container/Action"]
unique_name_in_owner = true
layout_mode = 2
texture = ExtResource("4_b4uwv")
[node name="ActionText" type="Label" parent="CanvasLayer/Inspector/Container/Action"]
unique_name_in_owner = true
z_index = 1

View File

@ -1,5 +1,8 @@
extends Node
const DEFAULT_ACTION_COLOR = Color.WHITE
const ENERGY_ACTION_COLOR = Color("ffff2b")
@export var default_cursor : Texture2D
var inspected_entity : InspectableEntity = null
@ -75,9 +78,13 @@ func update_inspector():
if can_interact and inspected_entity and inspected_entity is Interactable:
%Action.visible = true
%ActionText.text = inspected_entity.interact_text()
%Action.modulate = DEFAULT_ACTION_COLOR if inspected_entity.interaction_cost(player) == 0 else ENERGY_ACTION_COLOR
%ActionEnergyImage.visible = inspected_entity.interaction_cost(player) != 0
elif can_use_item and current_selected_item:
%Action.visible = true
%ActionText.text = current_selected_item.use_text()
%Action.modulate = DEFAULT_ACTION_COLOR if current_selected_item.use_energy == 0 else ENERGY_ACTION_COLOR
%ActionEnergyImage.visible = current_selected_item.use_energy != 0
else:
%Action.visible = false