Add different type of inventory item (armor)

This commit is contained in:
2024-09-03 23:37:49 -07:00
parent 19d3c40fef
commit 9a24ebf058
12 changed files with 59 additions and 10 deletions

View File

@@ -0,0 +1,9 @@
using Godot;
namespace GameJamDungeon
{
public abstract partial class InventoryItem : Node3D
{
public abstract InventoryItemInfo InventoryInfo { get; set; }
}
}

8
src/items/armor/Armor.cs Normal file
View File

@@ -0,0 +1,8 @@
using GameJamDungeon;
using Godot;
public partial class Armor : InventoryItem
{
[Export]
public override InventoryItemInfo InventoryInfo { get; set; }
}

View File

@@ -1,8 +1,12 @@
[gd_scene load_steps=2 format=3 uid="uid://dorr7v1tkeiy0"]
[gd_scene load_steps=4 format=3 uid="uid://dorr7v1tkeiy0"]
[ext_resource type="Script" path="res://src/items/armor/Armor.cs" id="1_cmjpq"]
[ext_resource type="Texture2D" uid="uid://cgoubcl86pib4" path="res://src/items/armor/armor.png" id="1_vpnem"]
[ext_resource type="Resource" uid="uid://chjmkb3aiomvr" path="res://src/items/armor/resources/PatheticCoat.tres" id="2_eftit"]
[node name="Armor" type="Node3D"]
script = ExtResource("1_cmjpq")
InventoryInfo = ExtResource("2_eftit")
[node name="Sprite3D" type="Sprite3D" parent="."]
billboard = 2

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="InventoryItemInfo" load_steps=2 format=3 uid="uid://chjmkb3aiomvr"]
[ext_resource type="Script" path="res://src/items/InventoryItemInfo.cs" id="1_qywua"]
[resource]
script = ExtResource("1_qywua")
Name = "Pathetic"
Description = "A pathetic coat."

View File

@@ -1,7 +1,15 @@
using GameJamDungeon;
using Godot;
public partial class Weapon : Node3D
public partial class Weapon : InventoryItem
{
public Weapon()
{
_inventoryInfo = WeaponInfo.Default;
}
[Export]
public WeaponInfo InventoryInfo;
private WeaponInfo _inventoryInfo { get; set; }
public override InventoryItemInfo InventoryInfo { get => _inventoryInfo; set => _inventoryInfo = value as WeaponInfo; }
}

View File

@@ -6,7 +6,7 @@
[node name="CommonSword" type="Node3D"]
script = ExtResource("1_sr3bh")
InventoryInfo = ExtResource("2_krjts")
_inventoryInfo = ExtResource("2_krjts")
[node name="Sprite3D" type="Sprite3D" parent="."]
billboard = 2

View File

@@ -6,7 +6,7 @@
[node name="RareSword" type="Node3D"]
script = ExtResource("1_f8v7v")
InventoryInfo = ExtResource("2_6nmyd")
_inventoryInfo = ExtResource("2_6nmyd")
[node name="Sprite3D" type="Sprite3D" parent="."]
billboard = 2

View File

@@ -6,7 +6,7 @@
[node name="UncommonSword" type="Node3D"]
script = ExtResource("1_3o4dy")
InventoryInfo = ExtResource("2_ga52m")
_inventoryInfo = ExtResource("2_ga52m")
[node name="Sprite3D" type="Sprite3D" parent="."]
billboard = 2