Throw item

This commit is contained in:
2024-09-22 14:40:53 -07:00
parent 490f0d17d2
commit 84ee313ce5
9 changed files with 30 additions and 34 deletions

View File

@@ -13,6 +13,8 @@ public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvid
public IPlayer Player { get; }
public void DropItem(IInventoryItem item);
public void ThrowItem(IInventoryItem item);
}
[Meta(typeof(IAutoNode))]
@@ -143,6 +145,15 @@ public partial class Game : Node3D, IGame
dropped.Drop();
}
public void ThrowItem(IInventoryItem item)
{
var thrownScene = GD.Load<PackedScene>("res://src/items/thrown/ThrownItem.tscn");
var thrown = thrownScene.Instantiate<ThrownItem>();
thrown.ThrownItemStats = item.Info;
AddChild(thrown);
thrown.Throw();
}
private void OnEnemyDefeated(Vector3 vector, EnemyStatResource resource)
{
var restorativeScene = GD.Load<PackedScene>("res://src/items/restorative/Restorative.tscn");