diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-04 21:08:57 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-04 21:08:57 -0300 |
| commit | 4b2afd3e2144e42bfa7f11a870584b9255052cf7 (patch) | |
| tree | 11bcb45e3c93532d2aeaea69b4387ccda365bc22 /scripts/entities/actions | |
| parent | 1e248d3dd18f7c6bfaf8066c4662facbbb89e8f9 (diff) | |
INVENTÁRIO PEGÁVEL AAAAAAAAAAAAAAAAAAAAAAAAAAAA
Diffstat (limited to 'scripts/entities/actions')
| -rw-r--r-- | scripts/entities/actions/PickUpAction.cs | 34 | ||||
| -rw-r--r-- | scripts/entities/actions/PickUpAction.cs.uid | 1 |
2 files changed, 35 insertions, 0 deletions
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 diff --git a/scripts/entities/actions/PickUpAction.cs.uid b/scripts/entities/actions/PickUpAction.cs.uid new file mode 100644 index 0000000..7ca9c72 --- /dev/null +++ b/scripts/entities/actions/PickUpAction.cs.uid @@ -0,0 +1 @@ +uid://dydpoqnwxwbq6 |
