From 4b2afd3e2144e42bfa7f11a870584b9255052cf7 Mon Sep 17 00:00:00 2001 From: Matheus Date: Thu, 4 Sep 2025 21:08:57 -0300 Subject: INVENTÁRIO PEGÁVEL AAAAAAAAAAAAAAAAAAAAAAAAAAAA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/entities/actions/PickUpAction.cs | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 scripts/entities/actions/PickUpAction.cs (limited to 'scripts/entities/actions/PickUpAction.cs') diff --git a/scripts/entities/actions/PickUpAction.cs b/scripts/entities/actions/PickUpAction.cs new file mode 100644 index 0000000..b772bb7 --- /dev/null +++ b/scripts/entities/actions/PickUpAction.cs @@ -0,0 +1,34 @@ +using Godot; + +public partial class PickupAction : DirectionalAction +{ + protected Player player; + + public PickupAction(Player player, Vector2I offset) : base(player, offset) + { + this.player = player; + // Pegar itens requer um tempo menor. + cost = 2; + } + + public override bool Perform() + { + ConsumableItem item = Map_Data.GetFirstItemAtPosition(Destination); + + if (item == null) { + MessageLogData.Instance.AddMessage("Não tem item aqui."); + return false; + } + + if (player.inventory.Items.Count >= player.inventory.Capacity) { + MessageLogData.Instance.AddMessage("Seu inventário está cheio"); + return false; + } + + Map_Data.RemoveEntity(item); + player.inventory.Add(item); + + player.Energy -= cost; + return true; + } +} \ No newline at end of file -- cgit v1.2.3