Spawn items
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using Godot;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class ArmorItem : InventoryItem
|
||||
public partial class ArmorItem : InventoryItemInfo
|
||||
{
|
||||
[Export]
|
||||
public required int Defense { get; set; }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Godot;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class InventoryItem : Resource
|
||||
public partial class InventoryItemInfo : Resource
|
||||
{
|
||||
[Export]
|
||||
public string Name = string.Empty;
|
||||
12
src/items/ItemDatabase.cs
Normal file
12
src/items/ItemDatabase.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Godot;
|
||||
|
||||
namespace GameJamDungeon
|
||||
{
|
||||
public partial class ItemDatabase : Node
|
||||
{
|
||||
[Export]
|
||||
public PackedScene[] ItemScene;
|
||||
[Export]
|
||||
public float[] DropRate;
|
||||
}
|
||||
}
|
||||
11
src/items/ItemDatabase.tscn
Normal file
11
src/items/ItemDatabase.tscn
Normal file
@@ -0,0 +1,11 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://twrj4wixcbu7"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/ItemDatabase.cs" id="1_7b315"]
|
||||
[ext_resource type="PackedScene" uid="uid://b6atdgf2e6e2t" path="res://src/items/weapons/models/CommonSword.tscn" id="2_wan01"]
|
||||
[ext_resource type="PackedScene" uid="uid://cbb1fxllrnlyr" path="res://src/items/weapons/models/UncommonSword.tscn" id="3_d4tq3"]
|
||||
[ext_resource type="PackedScene" uid="uid://c10nhqq8su6pp" path="res://src/items/weapons/models/RareSword.tscn" id="4_q5drd"]
|
||||
|
||||
[node name="ItemDatabase" type="Node"]
|
||||
script = ExtResource("1_7b315")
|
||||
ItemScene = Array[PackedScene]([ExtResource("2_wan01"), ExtResource("3_d4tq3"), ExtResource("4_q5drd")])
|
||||
DropRate = PackedFloat32Array(0.7, 0.25, 0.1)
|
||||
10
src/items/WeaponInfo.cs
Normal file
10
src/items/WeaponInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Godot;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class WeaponInfo : InventoryItemInfo
|
||||
{
|
||||
[Export]
|
||||
public required int Damage { get; set; }
|
||||
|
||||
public static WeaponInfo Default => new WeaponInfo() { Damage = 1 };
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using Godot;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class WeaponItem : InventoryItem
|
||||
{
|
||||
[Export]
|
||||
public required int Damage { get; set; }
|
||||
|
||||
public static WeaponItem Default => new WeaponItem() { Damage = 1 };
|
||||
}
|
||||
7
src/items/weapons/Weapon.cs
Normal file
7
src/items/weapons/Weapon.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Godot;
|
||||
|
||||
public partial class Weapon : Node3D
|
||||
{
|
||||
[Export]
|
||||
public WeaponInfo InventoryInfo;
|
||||
}
|
||||
124
src/items/weapons/models/CommonSword.tscn
Normal file
124
src/items/weapons/models/CommonSword.tscn
Normal file
File diff suppressed because one or more lines are too long
130
src/items/weapons/models/RareSword.tscn
Normal file
130
src/items/weapons/models/RareSword.tscn
Normal file
File diff suppressed because one or more lines are too long
BIN
src/items/weapons/models/Sword listo.blend
Normal file
BIN
src/items/weapons/models/Sword listo.blend
Normal file
Binary file not shown.
52
src/items/weapons/models/Sword listo.blend.import
Normal file
52
src/items/weapons/models/Sword listo.blend.import
Normal file
@@ -0,0 +1,52 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://3porhq4nswqq"
|
||||
path="res://.godot/imported/Sword listo.blend-c265962670e3da01fc090f88cb132d4d.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/items/weapons/models/Sword listo.blend"
|
||||
dest_files=["res://.godot/imported/Sword listo.blend-c265962670e3da01fc090f88cb132d4d.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
blender/nodes/visible=0
|
||||
blender/nodes/active_collection_only=false
|
||||
blender/nodes/punctual_lights=true
|
||||
blender/nodes/cameras=true
|
||||
blender/nodes/custom_properties=true
|
||||
blender/nodes/modifiers=1
|
||||
blender/meshes/colors=false
|
||||
blender/meshes/uvs=true
|
||||
blender/meshes/normals=true
|
||||
blender/meshes/export_geometry_nodes_instances=false
|
||||
blender/meshes/tangents=true
|
||||
blender/meshes/skins=2
|
||||
blender/meshes/export_bones_deforming_mesh_only=false
|
||||
blender/materials/unpack_enabled=true
|
||||
blender/materials/export_materials=1
|
||||
blender/animation/limit_playback=true
|
||||
blender/animation/always_sample=true
|
||||
blender/animation/group_tracks=true
|
||||
121
src/items/weapons/models/UncommonSword.tscn
Normal file
121
src/items/weapons/models/UncommonSword.tscn
Normal file
File diff suppressed because one or more lines are too long
9
src/items/weapons/resources/CommonSword.tres
Normal file
9
src/items/weapons/resources/CommonSword.tres
Normal file
@@ -0,0 +1,9 @@
|
||||
[gd_resource type="Resource" script_class="WeaponInfo" load_steps=2 format=3 uid="uid://dq8tdmjhrqsrh"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/WeaponInfo.cs" id="1_wc11x"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_wc11x")
|
||||
Damage = 2
|
||||
Name = "Common Sword"
|
||||
Description = "This is just a regular sword."
|
||||
9
src/items/weapons/resources/RareSword.tres
Normal file
9
src/items/weapons/resources/RareSword.tres
Normal file
@@ -0,0 +1,9 @@
|
||||
[gd_resource type="Resource" script_class="WeaponInfo" load_steps=2 format=3 uid="uid://b4oxsf4k3nr43"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/WeaponInfo.cs" id="1_ybm7s"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_ybm7s")
|
||||
Damage = 7
|
||||
Name = "Rare Sword"
|
||||
Description = "Wow. How did you get this one?"
|
||||
9
src/items/weapons/resources/UncommonSword.tres
Normal file
9
src/items/weapons/resources/UncommonSword.tres
Normal file
@@ -0,0 +1,9 @@
|
||||
[gd_resource type="Resource" script_class="WeaponInfo" load_steps=2 format=3 uid="uid://e0t7swnl2sfd"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/WeaponInfo.cs" id="1_0u4lk"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_0u4lk")
|
||||
Damage = 4
|
||||
Name = "Uncommon Sword."
|
||||
Description = "This one is a little bit better."
|
||||
Reference in New Issue
Block a user