blob: b772bb786f12734ca2faee755b57cddbef295039 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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;
}
}
|