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

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