#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:
@@ -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")
|
||||
@@ -1 +0,0 @@
|
||||
uid://j5xvcabrspyb
|
||||
@@ -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")
|
||||
@@ -1 +0,0 @@
|
||||
uid://bb38yqsd072ws
|
||||
@@ -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)
|
||||
@@ -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")
|
||||
@@ -1 +0,0 @@
|
||||
uid://yutflvdgdk04
|
||||
Reference in New Issue
Block a user