Drop item

This commit is contained in:
2024-09-22 14:00:52 -07:00
parent 01477b9a0e
commit 490f0d17d2
25 changed files with 401 additions and 257 deletions

View File

@@ -5,7 +5,7 @@ using Godot;
using System;
[Meta(typeof(IAutoNode))]
public partial class ThrowableItem : Node3D, IInventoryItem
public partial class ThrowableItem : Node3D, IThrowableItem
{
public override void _Notification(int what) => this.Notify(what);
@@ -32,16 +32,13 @@ public partial class ThrowableItem : Node3D, IInventoryItem
Pickup.BodyEntered += OnEntered;
}
public void Throw(ThrowableItemStats throwableItemStats)
public void Throw()
{
var throwableScene = GD.Load<PackedScene>("res://src/items/thrown/ThrownGeometricDice.tscn");
var throwableScene = GD.Load<PackedScene>("res://src/items/thrown/ThrownItem.tscn");
var throwable = throwableScene.Instantiate<ThrownItem>();
throwable.ThrownItemStats = ThrowableItemInfo;
Game.AddChild(throwable);
throwable.Throw(throwableItemStats);
}
public void Drop()
{
throwable.Throw();
GameRepo.PlayerData.Inventory.Remove(this);
}