Spawn items

This commit is contained in:
2024-08-28 21:48:05 -07:00
parent 699a333951
commit ea99e88535
25 changed files with 715 additions and 134 deletions

View File

@@ -29,67 +29,115 @@ room_cost_at_end_for_required_doors = 1.0
[node name="RoomsContainer" type="Node3D" parent="DungeonGenerator3D"]
[node name="DungeonRoom3D_0" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("4_56rmd")]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 25, 0, -25)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35, 0, 35)
[node name="DungeonRoom3D_1" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("4_clpvl")]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 5, 0, 25)
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 15, 0, 5)
[node name="Corridor_2" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, -25)
[node name="DungeonRoom3D_2" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("4_56rmd")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -35, 0, 5)
[node name="Corridor_3" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, -15)
[node name="DungeonRoom3D_3" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("4_clpvl")]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -15, 0, -45)
[node name="Corridor_4" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, -5)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35, 0, 25)
[node name="Corridor_5" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, 5)
[node name="Corridor_6" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, 15)
[node name="Corridor_7" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, 25)
[node name="Corridor_8" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35, 0, -25)
[node name="Corridor_9" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35, 0, -15)
[node name="Corridor_10" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35, 0, -5)
[node name="Corridor_11" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35, 0, 5)
[node name="Corridor_12" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35, 0, 15)
[node name="Corridor_6" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35, 0, 5)
[node name="Corridor_7" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 25, 0, 5)
[node name="Corridor_8" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 25, 0, -5)
[node name="Corridor_9" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 25, 0, -15)
[node name="Corridor_10" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 25, 0, -25)
[node name="Corridor_11" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, -25)
[node name="Corridor_12" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -25)
[node name="Corridor_13" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 25, 0, 15)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, -25)
[node name="Corridor_14" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 25, 0, 25)
[node name="Corridor_15" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 25)
[node name="Corridor_16" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 15)
[node name="Corridor_17" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 5)
[node name="Corridor_18" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, -5)
[node name="Corridor_19" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, -15)
[node name="Corridor_15" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, -15)
[node name="Corridor_16" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, -5)
[node name="Corridor_17" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, -5)
[node name="Corridor_18" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -35, 0, -5)
[node name="Corridor_19" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -35, 0, -15)
[node name="Corridor_20" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -15)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -35, 0, -25)
[node name="Corridor_21" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -35, 0, -35)
[node name="Corridor_22" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -45, 0, -35)
[node name="Corridor_23" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -45, 0, -45)
[node name="Corridor_24" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35, 0, 45)
[node name="Corridor_25" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 25, 0, 45)
[node name="Corridor_26" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 25, 0, 35)
[node name="Corridor_27" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, 35)
[node name="Corridor_28" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -35, 0, 15)
[node name="Corridor_29" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, 15)
[node name="Corridor_30" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, 15)
[node name="Corridor_31" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 15)
[node name="Corridor_32" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, 15)
[node name="Corridor_33" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, 25)
[node name="Corridor_34" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, 35)
[node name="Corridor_35" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, -45)
[node name="Corridor_36" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_aur0q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, -35)
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_fke5g")

View File

@@ -8,7 +8,7 @@ namespace GameJamDungeon
{
public readonly record struct StartGame();
public readonly record struct SetInventoryMode(List<InventoryItem> Inventory);
public readonly record struct SetInventoryMode(List<InventoryItemInfo> Inventory);
public readonly record struct HideInventory();

View File

@@ -9,7 +9,7 @@ public interface IGameRepo : IDisposable
{
event Action? Ended;
IAutoProp<List<InventoryItem>> InventoryItems { get; }
IAutoProp<List<InventoryItemInfo>> InventoryItems { get; }
IAutoProp<bool> IsInventoryScreenOpened { get; }
@@ -28,10 +28,10 @@ public class GameRepo : IGameRepo
{
public event Action? Ended;
private readonly AutoProp<List<InventoryItem>> _inventoryItems;
private readonly AutoProp<List<InventoryItemInfo>> _inventoryItems;
private readonly AutoProp<bool> _isInventoryScreenOpened;
public IAutoProp<List<InventoryItem>> InventoryItems => _inventoryItems;
public IAutoProp<List<InventoryItemInfo>> InventoryItems => _inventoryItems;
public IAutoProp<bool> IsInventoryScreenOpened => _isInventoryScreenOpened;
@@ -45,7 +45,7 @@ public class GameRepo : IGameRepo
public GameRepo()
{
_inventoryItems = new AutoProp<List<InventoryItem>>([]);
_inventoryItems = new AutoProp<List<InventoryItemInfo>>([]);
_isInventoryScreenOpened = new AutoProp<bool>(false);
_isPaused = new AutoProp<bool>(false);
_playerGlobalPosition = new AutoProp<Vector3>(Vector3.Zero);

View File

@@ -7,7 +7,7 @@ using System.Collections.Generic;
public interface IInventoryMenu : IControl
{
public void PopulateItems(List<InventoryItem> items);
public void PopulateItems(List<InventoryItemInfo> items);
public void ClearItems();
}
@@ -25,7 +25,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
private int _currentSelection = 0;
public void PopulateItems(List<InventoryItem> items)
public void PopulateItems(List<InventoryItemInfo> items)
{
foreach (var item in items)
{
@@ -103,13 +103,13 @@ public partial class InventoryMenu : Control, IInventoryMenu
public partial class WeaponLabel : Label
{
public WeaponLabel(InventoryItem inventoryItem)
public WeaponLabel(InventoryItemInfo inventoryItem)
{
InventoryItem = inventoryItem;
LabelSettings = UnequippedItemFont;
}
public InventoryItem InventoryItem { get; set; } = default!;
public InventoryItemInfo InventoryItem { get; set; } = default!;
private static LabelSettings UnequippedItemFont => GD.Load<LabelSettings>("res://src/vfx/Fonts/InventoryLabelSettings.tres");
private static LabelSettings EquippedItemFont => GD.Load<LabelSettings>("res://src/vfx/Fonts/EquippedInventoryLabelSettings.tres");

View File

@@ -1,7 +1,7 @@
using Godot;
[GlobalClass]
public partial class ArmorItem : InventoryItem
public partial class ArmorItem : InventoryItemInfo
{
[Export]
public required int Defense { get; set; }

View File

@@ -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
View File

@@ -0,0 +1,12 @@
using Godot;
namespace GameJamDungeon
{
public partial class ItemDatabase : Node
{
[Export]
public PackedScene[] ItemScene;
[Export]
public float[] DropRate;
}
}

View 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
View 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 };
}

View File

@@ -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 };
}

View File

@@ -0,0 +1,7 @@
using Godot;
public partial class Weapon : Node3D
{
[Export]
public WeaponInfo InventoryInfo;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

View 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

File diff suppressed because one or more lines are too long

View 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."

View 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?"

View 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."

View File

@@ -1,59 +1,42 @@
[gd_scene load_steps=11 format=3 uid="uid://bn4gslp2gk8ds"]
[gd_scene load_steps=7 format=3 uid="uid://bn4gslp2gk8ds"]
[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_y0rqi"]
[ext_resource type="Texture2D" uid="uid://n4ds85jp0aq0" path="res://src/map/dungeon/textures/map_ceiling.jpg" id="2_6scux"]
[ext_resource type="PackedScene" uid="uid://ckaw6wjmi0fom" path="res://src/map/dungeon/door/Door.tscn" id="2_vpnlr"]
[ext_resource type="Script" path="res://src/map/dungeon/corridor/remove_unused_doors.gd" id="3_8i1ij"]
[ext_resource type="Texture2D" uid="uid://bidlc5a6lft6" path="res://src/map/dungeon/textures/map_brickwall.jpg" id="4_6qf87"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nsah4"]
transparency = 1
albedo_texture = ExtResource("2_6scux")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_kdikn"]
albedo_color = Color(1, 1, 0, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_18cgv"]
albedo_texture = ExtResource("2_6scux")
uv1_scale = Vector3(0.23, 0.23, 0.23)
uv1_triplanar = true
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ej8w2"]
albedo_texture = ExtResource("4_6qf87")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_oy7nu"]
albedo_texture = ExtResource("4_6qf87")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_qay2n"]
albedo_color = Color(1, 1, 0, 1)
[sub_resource type="PlaneMesh" id="PlaneMesh_7myha"]
size = Vector2(10, 10)
[node name="Corridor" type="Node3D"]
script = ExtResource("1_y0rqi")
min_count = 1
max_count = 1
[node name="CSGBox3D" type="CSGBox3D" parent="."]
use_collision = true
size = Vector3(10, 10, 10)
material = SubResource("StandardMaterial3D_nsah4")
material = SubResource("StandardMaterial3D_kdikn")
[node name="CSGBox3D" type="CSGBox3D" parent="CSGBox3D"]
operation = 2
size = Vector3(9, 9, 9)
material = SubResource("StandardMaterial3D_18cgv")
material = SubResource("StandardMaterial3D_qay2n")
[node name="DOOR?4" parent="CSGBox3D" instance=ExtResource("2_vpnlr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.58627, 5)
material = SubResource("StandardMaterial3D_ej8w2")
[node name="DOOR?5" parent="CSGBox3D" instance=ExtResource("2_vpnlr")]
transform = Transform3D(-0.0899894, 0, 0.995943, 0, 1, 0, -0.995943, 0, -0.0899894, -4.7076, -2.586, 0)
material = SubResource("StandardMaterial3D_ej8w2")
[node name="DOOR?6" parent="CSGBox3D" instance=ExtResource("2_vpnlr")]
transform = Transform3D(-0.0899894, 0, 0.995943, 0, 1, 0, -0.995943, 0, -0.0899894, 4.73741, -2.586, 0)
material = SubResource("StandardMaterial3D_ej8w2")
[node name="DOOR?2" parent="CSGBox3D" instance=ExtResource("2_vpnlr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.58627, -5)
material = SubResource("StandardMaterial3D_oy7nu")
[node name="RemoveUnusedDoors" type="Node" parent="."]
script = ExtResource("3_8i1ij")

View File

@@ -23,6 +23,10 @@ public partial class DungeonRoom : Node3D, IDungeonRoom, IProvide<DungeonRoomLog
[Node] public Marker3D PlayerSpawn { get; set; } = default!;
[Node] public Node3D ItemSpawnPoints { get; set; } = default!;
[Node] public ItemDatabase ItemDatabase { get; set; } = default!;
public DungeonRoomLogic.IBinding DungeonRoomBinding { get; set; } = default!;
public void Setup()
@@ -30,6 +34,28 @@ public partial class DungeonRoom : Node3D, IDungeonRoom, IProvide<DungeonRoomLog
DungeonRoomLogic = new DungeonRoomLogic();
DungeonRoomLogic.Set(this as IDungeonRoom);
DungeonRoomLogic.Set(GameRepo);
PopulateRoom();
}
private void PopulateRoom()
{
var itemSpawnPoints = ItemSpawnPoints.GetChildren();
var rng = new RandomNumberGenerator();
rng.Randomize();
var numberOfItemsToSpawn = rng.RandiRange(0, itemSpawnPoints.Count);
itemSpawnPoints.Shuffle();
foreach (Marker3D spawnPoint in itemSpawnPoints)
{
if (numberOfItemsToSpawn <= 0)
break;
numberOfItemsToSpawn--;
var item = ItemDatabase.ItemScene[rng.RandWeighted(ItemDatabase.DropRate)];
var instantiatedItem = item.Instantiate<Weapon>();
instantiatedItem.Position = spawnPoint.Position;
AddChild(instantiatedItem);
GD.Print(instantiatedItem.InventoryInfo.Name);
}
}
public void OnResolved()

View File

@@ -1,42 +1,49 @@
[gd_scene load_steps=7 format=3 uid="uid://dhpwwqow1ahrc"]
[gd_scene load_steps=10 format=3 uid="uid://dhpwwqow1ahrc"]
[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_0tfda"]
[ext_resource type="Script" path="res://src/map/dungeon/rooms/DungeonRoom.cs" id="1_ti7ur"]
[ext_resource type="PackedScene" uid="uid://ckaw6wjmi0fom" path="res://src/map/dungeon/door/Door.tscn" id="2_mdawx"]
[ext_resource type="Texture2D" uid="uid://bidlc5a6lft6" path="res://src/map/dungeon/textures/map_brickwall.jpg" id="2_rw3uc"]
[ext_resource type="PackedScene" uid="uid://twrj4wixcbu7" path="res://src/items/ItemDatabase.tscn" id="4_2mnb7"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_gt3ar"]
albedo_texture = ExtResource("2_rw3uc")
uv1_scale = Vector3(0.105, 0.105, 0.105)
uv1_triplanar = true
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nin6j"]
albedo_color = Color(1, 0, 0.0784314, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_5j6ws"]
albedo_color = Color(1, 0, 0.0784314, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_it7n4"]
albedo_color = Color(1, 0, 0.0784314, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_05l2p"]
albedo_color = Color(1, 0, 0.0784314, 1)
[sub_resource type="PlaneMesh" id="PlaneMesh_luhnj"]
size = Vector2(10, 10)
[node name="DungeonRoom3D" type="Node3D"]
script = ExtResource("1_0tfda")
min_count = 1
max_count = 3
[node name="DungeonRoom" type="Node3D" parent="."]
script = ExtResource("1_ti7ur")
[node name="CSGBox3D" type="CSGBox3D" parent="."]
material_override = SubResource("StandardMaterial3D_gt3ar")
use_collision = true
size = Vector3(10, 10, 10)
material = SubResource("StandardMaterial3D_nin6j")
[node name="CSGBox3D2" type="CSGBox3D" parent="CSGBox3D"]
material_override = SubResource("StandardMaterial3D_gt3ar")
operation = 2
use_collision = true
size = Vector3(9, 9, 9)
material = SubResource("StandardMaterial3D_5j6ws")
[node name="DOOR" parent="CSGBox3D" instance=ExtResource("2_mdawx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.54039, 4.74571)
material = SubResource("StandardMaterial3D_it7n4")
[node name="DOOR2" parent="CSGBox3D" instance=ExtResource("2_mdawx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.58282, -4.73548)
material = SubResource("StandardMaterial3D_05l2p")
[node name="PlayerSpawn" type="Marker3D" parent="."]
unique_name_in_owner = true
@@ -46,3 +53,13 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4.23461, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4.9805, 0)
layers = 2
mesh = SubResource("PlaneMesh_luhnj")
[node name="ItemSpawnPoints" type="Node3D" parent="."]
unique_name_in_owner = true
[node name="ItemSpawn1" type="Marker3D" parent="ItemSpawnPoints"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.54295, -4.48909, -2.92704)
gizmo_extents = 1.0
[node name="ItemDatabase" parent="." instance=ExtResource("4_2mnb7")]
unique_name_in_owner = true

View File

@@ -1,7 +1,8 @@
[gd_scene load_steps=7 format=3 uid="uid://bbwgmqy3evhh2"]
[gd_scene load_steps=10 format=3 uid="uid://bbwgmqy3evhh2"]
[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_o02dd"]
[ext_resource type="Script" path="res://src/map/dungeon/rooms/DungeonRoom.cs" id="2_jrlll"]
[ext_resource type="PackedScene" uid="uid://twrj4wixcbu7" path="res://src/items/ItemDatabase.tscn" id="4_c51bx"]
[ext_resource type="PackedScene" uid="uid://ckaw6wjmi0fom" path="res://src/map/dungeon/door/Door.tscn" id="4_nh0nj"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_b8kax"]
@@ -10,14 +11,18 @@ albedo_color = Color(0.0470588, 0, 1, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_1h648"]
albedo_color = Color(0.0470588, 0, 1, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_u3mvg"]
albedo_color = Color(0.0470588, 0, 1, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ham86"]
albedo_color = Color(0.0470588, 0, 1, 1)
[sub_resource type="PlaneMesh" id="PlaneMesh_j8q3j"]
size = Vector2(50, 10)
[node name="DungeonRoom3D" type="Node3D"]
script = ExtResource("1_o02dd")
size_in_voxels = Vector3i(5, 1, 1)
min_count = 1
max_count = 2
[node name="DungeonRoom" type="Node3D" parent="."]
script = ExtResource("2_jrlll")
@@ -35,24 +40,42 @@ size = Vector3(49, 9, 9)
material = SubResource("StandardMaterial3D_1h648")
[node name="DOOR" parent="CSGBox3D" instance=ExtResource("4_nh0nj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.54039, 4.74571)
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 25, -2.5, 0)
material = SubResource("StandardMaterial3D_u3mvg")
[node name="DOOR2" parent="CSGBox3D" instance=ExtResource("4_nh0nj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.58282, -4.73548)
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -24.578, -2.5, 0)
material = SubResource("StandardMaterial3D_ham86")
[node name="PlayerSpawn" type="Marker3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4.23461, 0)
[node name="ItemSpawnPoints" type="Node3D" parent="."]
unique_name_in_owner = true
[node name="ItemSpawn1" type="Marker3D" parent="ItemSpawnPoints"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15.3383, -4.48909, -2.92704)
gizmo_extents = 1.0
[node name="ItemSpawn2" type="Marker3D" parent="ItemSpawnPoints"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.50278, -4.48909, -2.92704)
gizmo_extents = 1.0
[node name="ItemSpawn3" type="Marker3D" parent="ItemSpawnPoints"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.08441, -4.48909, 2.87214)
gizmo_extents = 1.0
[node name="ItemSpawn4" type="Marker3D" parent="ItemSpawnPoints"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -16.3726, -4.48909, 2.87214)
gizmo_extents = 1.0
[node name="EnemySpawnPoints" type="Node3D" parent="."]
[node name="Minimap Texture" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4.50433, 0)
layers = 2
mesh = SubResource("PlaneMesh_j8q3j")
[node name="ItemDatabase" parent="." instance=ExtResource("4_c51bx")]
unique_name_in_owner = true

View File

@@ -12,6 +12,33 @@
[sub_resource type="CapsuleMesh" id="CapsuleMesh_dmans"]
[sub_resource type="Animation" id="Animation_hcjph"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("SwordSlashAnimation:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Area3D/Hitbox:disabled")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="Animation" id="Animation_0jjwv"]
resource_name = "attack"
length = 0.7
@@ -40,33 +67,6 @@ tracks/1/keys = {
"values": [true, false, true]
}
[sub_resource type="Animation" id="Animation_hcjph"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("SwordSlashAnimation:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Area3D/Hitbox:disabled")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_w8l8m"]
_data = {
"RESET": SubResource("Animation_hcjph"),

View File

@@ -13,9 +13,9 @@ namespace GameJamDungeon
public required PlayerLogic StateMachine { get; init; }
[Save("PlayerEquippedSword")]
public required InventoryItem EquippedWeapon { get; set; }
public required InventoryItemInfo EquippedWeapon { get; set; }
[Save("PlayerInventory")]
public required IEnumerable<InventoryItem> Inventory { get; set; }
public required IEnumerable<InventoryItemInfo> Inventory { get; set; }
}
}