Fix up item usage
This commit is contained in:
@@ -3,6 +3,7 @@ using Chickensoft.Introspection;
|
||||
using Zennysoft.Game.Ma.src.items;
|
||||
using Godot;
|
||||
using Zennysoft.Game.Ma.Implementation;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
@@ -15,7 +16,7 @@ public partial class ThrownItem : RigidBody3D
|
||||
|
||||
[Dependency] public IGame Game => this.DependOn<IGame>();
|
||||
|
||||
public InventoryItem ItemThatIsThrown;
|
||||
public IInventoryItem ItemThatIsThrown;
|
||||
|
||||
private EffectService _effectService;
|
||||
|
||||
@@ -25,7 +26,7 @@ public partial class ThrownItem : RigidBody3D
|
||||
{
|
||||
BodyEntered += ThrownItem_BodyEntered;
|
||||
GlobalPosition = Player.CurrentPosition;
|
||||
Sprite.Texture = ItemThatIsThrown.ItemStats.Texture;
|
||||
Sprite.Texture = ((InventoryItem)ItemThatIsThrown).ItemStats.Texture;
|
||||
AddCollisionExceptionWith((Node)Player);
|
||||
}
|
||||
|
||||
@@ -39,7 +40,7 @@ public partial class ThrownItem : RigidBody3D
|
||||
public void Throw(EffectService effectService)
|
||||
{
|
||||
_effectService = effectService;
|
||||
ApplyCentralImpulse(-Player.CurrentBasis.Z.Normalized() * ItemThatIsThrown.ThrowSpeed);
|
||||
ApplyCentralImpulse(-Player.CurrentBasis.Z.Normalized() * ((InventoryItem)ItemThatIsThrown).ThrowSpeed);
|
||||
}
|
||||
|
||||
public void RescueItem()
|
||||
@@ -100,6 +101,6 @@ public partial class ThrownItem : RigidBody3D
|
||||
}
|
||||
}
|
||||
else
|
||||
enemy.TakeDamage(ItemThatIsThrown.ThrowDamage);
|
||||
enemy.TakeDamage(((InventoryItem)ItemThatIsThrown).ThrowDamage);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user