refonte de l'inspecteur #61
This commit is contained in:
@@ -22,13 +22,26 @@ func _ready():
|
||||
if item and object_sprite:
|
||||
object_sprite.apply_texture_to_sprite(item.icon, ITEM_SPRITE_SIZE)
|
||||
|
||||
func pointer_text():
|
||||
var name_suffix = ""
|
||||
|
||||
func inspected_text():
|
||||
return item.name + (" Seed" if item is Seed else "")
|
||||
if item is Seed:
|
||||
name_suffix = "Seed"
|
||||
if item is Package:
|
||||
name_suffix = "Package"
|
||||
|
||||
return item.name + (" " + name_suffix if name_suffix else "")
|
||||
|
||||
func interact_text():
|
||||
return "Take"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text(),
|
||||
item.description,
|
||||
item.icon
|
||||
)
|
||||
|
||||
func interact(player : Player) -> bool:
|
||||
var swapped_item = player.inventory.get_item()
|
||||
|
||||
|
||||
@@ -7,12 +7,18 @@ var fill_value : float = 0.
|
||||
func _process(_delta):
|
||||
%ProgressBar.value = lerp(%ProgressBar.value, fill_value * 100, 0.5)
|
||||
|
||||
func inspected_text():
|
||||
func pointer_text():
|
||||
return "Compost"
|
||||
|
||||
func interact_text():
|
||||
return "Put a seed ("+str(roundi((1-fill_value)/value_per_seed))+" left)"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text(),
|
||||
"The compost allow you to upgrade your max energy when putting in it a certain amount of seeds."
|
||||
)
|
||||
|
||||
func can_interact(p : Player) -> bool:
|
||||
return p.inventory.get_item() and p.inventory.get_item() is Seed
|
||||
|
||||
|
||||
@@ -10,4 +10,13 @@ func interact(_p: Player) -> bool:
|
||||
return true
|
||||
|
||||
func interact_text():
|
||||
return "Recharge"
|
||||
return "Recharge"
|
||||
|
||||
func pointer_text():
|
||||
return "Recharge Station"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text(),
|
||||
"You can recharge your robot here. When recharging, time will pass and plants may grow."
|
||||
)
|
||||
@@ -22,6 +22,3 @@ func generate_collision(area_width : float) -> CollisionShape2D:
|
||||
add_child(collision)
|
||||
|
||||
return collision
|
||||
|
||||
func interact_text():
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user