#13 suite du developpement d'inventaire avec le rajout des ItemObjects, description sur le GUI, items d'exemple et corrections mineures

This commit was merged in pull request #35.
This commit is contained in:
2025-08-18 16:05:37 +02:00
parent d2742231e6
commit a91ca5f7f1
43 changed files with 755 additions and 90 deletions

View File

@@ -1,8 +0,0 @@
extends InteractableAction
class_name GetSeedInteraction
func action(p: Player, i : Interactable):
if i is Plant:
p.inventory.add_item(i.seed_item)
else :
printerr("No plant selected or interactable is not a plant")

View File

@@ -1 +0,0 @@
uid://j5xvcabrspyb

View File

@@ -1,8 +0,0 @@
extends InteractableAction
class_name WaterPlantAction
func action(_p: Player, i : Interactable):
if i is Plant:
i.watered = true
else :
printerr("No plant selected or interactable is not a plant")

View File

@@ -1 +0,0 @@
uid://bb38yqsd072ws

View File

@@ -1,8 +1,19 @@
extends Area2D
class_name Interactable
@export var actions : Array[InteractableAction] = []
var available : bool = true
func interact(p : Player):
for a in actions:
a.action(p, self)
func _ready():
printerr("Abstract Interactable class used")
func interact(_p : Player) -> bool:
printerr("Interact function called on abstract Interactable class")
return false
func generate_collision(area_width : float):
var collision = CollisionShape2D.new()
var collision_shape = CircleShape2D.new()
collision_shape.radius = area_width
collision.shape = collision_shape
add_child(collision)

View File

@@ -1,6 +0,0 @@
# Classe abstraite permettant de développer diverses actions
extends Resource
class_name InteractableAction
func action(_p: Player, _i : Interactable):
printerr("Méthode action de la classe abstraite InteractableAction appelée")

View File

@@ -1 +0,0 @@
uid://yutflvdgdk04