Add different type of inventory item (armor)
This commit is contained in:
9
src/items/InventoryItem.cs
Normal file
9
src/items/InventoryItem.cs
Normal 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
8
src/items/armor/Armor.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using GameJamDungeon;
|
||||
using Godot;
|
||||
|
||||
public partial class Armor : InventoryItem
|
||||
{
|
||||
[Export]
|
||||
public override InventoryItemInfo InventoryInfo { get; set; }
|
||||
}
|
||||
@@ -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
|
||||
|
||||
8
src/items/armor/resources/PatheticCoat.tres
Normal file
8
src/items/armor/resources/PatheticCoat.tres
Normal 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."
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user