Big fix of inventory system, add accessory item type
This commit is contained in:
@@ -7,17 +7,17 @@ using System.Linq;
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class Weapon : InventoryItem
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
public Weapon()
|
||||
{
|
||||
_inventoryInfo = WeaponInfo.Default;
|
||||
Info = new WeaponInfo() { Damage = 1 };
|
||||
}
|
||||
|
||||
[Export]
|
||||
private WeaponInfo _inventoryInfo { get; set; }
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
public override InventoryItemInfo InventoryInfo { get => _inventoryInfo; set => _inventoryInfo = value as WeaponInfo; }
|
||||
[Export]
|
||||
internal override InventoryItemInfo Info { get; set; }
|
||||
|
||||
public WeaponInfo WeaponInfo { get => (WeaponInfo)Info; }
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
@@ -26,7 +26,7 @@ public partial class Weapon : InventoryItem
|
||||
|
||||
public void OnEntered(Node3D body)
|
||||
{
|
||||
var inventoryList = GameRepo.InventoryItems.Value.Append(InventoryInfo).ToList();
|
||||
var inventoryList = GameRepo.InventoryItems.Value.Append(this).ToList();
|
||||
GameRepo.InventoryItems.OnNext(inventoryList);
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,4 @@ public partial class WeaponInfo : InventoryItemInfo
|
||||
|
||||
[Export]
|
||||
public double IgneousDamageBonus { get; set; }
|
||||
|
||||
public static WeaponInfo Default => new WeaponInfo() { Damage = 1 };
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ height = 0.940032
|
||||
|
||||
[node name="CommonSword" type="Node3D"]
|
||||
script = ExtResource("1_sr3bh")
|
||||
_inventoryInfo = ExtResource("2_krjts")
|
||||
Info = ExtResource("2_krjts")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
billboard = 2
|
||||
|
||||
@@ -10,7 +10,7 @@ height = 0.940032
|
||||
|
||||
[node name="RareSword" type="Node3D"]
|
||||
script = ExtResource("1_f8v7v")
|
||||
_inventoryInfo = ExtResource("2_6nmyd")
|
||||
Info = ExtResource("2_6nmyd")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
billboard = 2
|
||||
|
||||
@@ -10,7 +10,7 @@ height = 0.940032
|
||||
|
||||
[node name="UncommonSword" type="Node3D"]
|
||||
script = ExtResource("1_3o4dy")
|
||||
_inventoryInfo = ExtResource("2_ga52m")
|
||||
Info = ExtResource("2_ga52m")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
billboard = 2
|
||||
|
||||
Reference in New Issue
Block a user