Remove in-progress work that isn't working well

This commit is contained in:
2024-09-01 12:59:48 -07:00
parent ea99e88535
commit b1ef3dbaab
52 changed files with 1521 additions and 166 deletions

View File

@@ -70,8 +70,16 @@ Inventory={
] ]
} }
[layer_names]
3d_physics/layer_1="World"
3d_physics/layer_2="Player"
3d_physics/layer_3="Items"
3d_physics/layer_4="Enemy"
3d_physics/layer_5="Weapon"
3d_physics/layer_6="Alert"
[physics] [physics]
3d/run_on_separate_thread=true 3d/run_on_separate_thread=true
common/physics_ticks_per_second=144 common/physics_ticks_per_second=144
3d/physics_engine="GodotPhysics3D"

View File

@@ -2,6 +2,7 @@
using Chickensoft.GodotNodeInterfaces; using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection; using Chickensoft.Introspection;
using Godot; using Godot;
using System.Linq;
namespace GameJamDungeon namespace GameJamDungeon
{ {

View File

@@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=3 uid="uid://br6dlxj36fw5i"]
[sub_resource type="BoxShape3D" id="BoxShape3D_7056c"]
[node name="CollisionDetector" type="Area3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.500351, 0)
disable_mode = 2
collision_layer = 16
collision_mask = 16
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.50124, 0)
shape = SubResource("BoxShape3D_7056c")

150
src/enemy/Enemy.cs Normal file
View File

@@ -0,0 +1,150 @@
using Chickensoft.AutoInject;
using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection;
using Godot;
using System.Linq;
namespace GameJamDungeon;
public interface IEnemy : ICharacterBody3D
{
public IEnemyLogic EnemyLogic { get; }
public int CurrentHP { get; set; }
public Resource EnemyStats { get; set; }
}
[Meta(typeof(IAutoNode))]
public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
{
public override void _Notification(int what) => this.Notify(what);
public IEnemyLogic EnemyLogic { get; set; } = default!;
IEnemyLogic IProvide<IEnemyLogic>.Value() => EnemyLogic;
public EnemyLogic.IBinding EnemyBinding { get; set; } = default!;
[Dependency] IGameRepo GameRepo => this.DependOn<IGameRepo>();
[Export]
public Resource EnemyStats { get; set; } = new();
[Node] public Area3D DetectionSphere { get; set; } = default!;
[Node] public Area3D AlertedSphere { get; set; } = default!;
public static PackedScene CollisionDetectorScene => GD.Load<PackedScene>("res://src/enemy/CollisionDetector.tscn");
public static Area3D CollisionDetector { get; set; } = default!;
public int CurrentHP { get; set; }
public void Setup()
{
EnemyLogic = new EnemyLogic();
EnemyLogic.Set(EnemyStats);
EnemyLogic.Set(this as IEnemy);
EnemyLogic.Set(GameRepo);
}
public void Initialize()
{
var enemyResource = EnemyStats as EnemyStats;
CurrentHP = enemyResource.MaximumHP;
DetectionSphere.BodyEntered += OnDetectionSphereEntered;
AlertedSphere.BodyExited += OnAlertedSphereExited;
}
public void OnResolved()
{
EnemyBinding = EnemyLogic.Bind();
EnemyBinding
.Handle((in EnemyLogic.Output.MovementComputed output) =>
{
var spriteNode = GetChildren().OfType<AnimatedSprite3D>();
if (spriteNode.Any())
PlayMovementAnimations(spriteNode.Single(), Velocity);
MoveAndCollide(output.Velocity);
})
.Handle((in EnemyLogic.Output.Die output) =>
{
CollisionDetector.Dispose();
QueueFree();
})
.Handle((in EnemyLogic.Output.HitByPlayer output) =>
{
});
this.Provide();
EnemyLogic.Start();
}
public void PlayMovementAnimations(AnimatedSprite3D sprite, Vector3 velocity)
{
if (sprite != null && velocity.Length() > 0.2f)
{
var lookdir = (GlobalPosition).Normalized();
var sign = lookdir.Sign();
if (lookdir.MaxAxisIndex() == Vector3.Axis.X && sign.X == 1)
sprite.Play("walk_right");
if (lookdir.MaxAxisIndex() == Vector3.Axis.X && sign.X == -1)
sprite.Play("walk_left");
if (lookdir.MaxAxisIndex() == Vector3.Axis.Z && sign.Z == 1)
sprite.Play("walk_forward");
if (lookdir.MaxAxisIndex() == Vector3.Axis.Z && sign.Z == -1)
sprite.Play("walk_backward");
}
if (sprite != null && velocity.IsZeroApprox())
sprite.Stop();
}
public void OnPhysicsProcess(double delta)
{
EnemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
}
public void OnPlayerHitboxEntered(Area3D body)
{
if (body.GetParent() is IPlayer)
{
if (CurrentHP > 0)
{
GD.Print("Enemy Hit");
EnemyLogic.Input(new EnemyLogic.Input.HitByPlayer());
}
}
}
public void OnDetectionSphereEntered(Node3D body)
{
GD.Print($"Detected {body.Name}...");
EnemyLogic.Input(new EnemyLogic.Input.Alerted());
}
public void OnAlertedSphereExited(Node3D body)
{
GD.Print($"Lost track of {body.Name}...");
EnemyLogic.Input(new EnemyLogic.Input.LostPlayer());
}
public void OnReady()
{
SetPhysicsProcess(true);
CollisionDetector = CollisionDetectorScene.Instantiate<Area3D>();
CollisionDetector.AreaEntered += OnPlayerHitboxEntered;
AddChild(CollisionDetector);
}
public void OnExitTree()
{
EnemyLogic.Stop();
EnemyBinding.Dispose();
}
}

View File

@@ -0,0 +1,10 @@
using Godot;
public partial class EnemyDatabase : Node
{
[Export]
public PackedScene[] EnemyList;
[Export]
public float[] SpawnRate;
}

View File

@@ -0,0 +1,9 @@
[gd_scene load_steps=3 format=3 uid="uid://dbvr8ewajja6a"]
[ext_resource type="Script" path="res://src/enemy/EnemyDatabase.cs" id="1_ywy58"]
[ext_resource type="PackedScene" uid="uid://dcgj5i52i76gj" path="res://src/enemy/enemy_types/FloatingEnemy.tscn" id="2_8cbrh"]
[node name="EnemyDatabase" type="Node"]
script = ExtResource("1_ywy58")
EnemyList = Array[PackedScene]([ExtResource("2_8cbrh")])
SpawnRate = PackedFloat32Array(1)

View File

@@ -0,0 +1,19 @@
shader_type spatial;
uniform bool enable = false;
uniform vec3 albedo_color : source_color = vec3(1.0);
void vertex() {
if (enable)
//VERTEX.x += cos(VERTEX.x * 3.0 * TIME) * sin(VERTEX.z * 24.0 * TIME);
VERTEX.y += cos(VERTEX.y * 2.0 * TIME) * sin(VERTEX.y * 3.0 * TIME);
}
void fragment() {
// Called for every pixel the material is visible on.
ALBEDO = albedo_color;
}
//void light() {
// Called for every pixel for every light affecting the material.
// Uncomment to replace the default light processing function with this one.
//}

9
src/enemy/EnemyDie.tres Normal file
View File

@@ -0,0 +1,9 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://wrsnwuvv1rw3"]
[ext_resource type="Shader" path="res://src/enemy/EnemyDie.gdshader" id="1_pk3sx"]
[resource]
render_priority = 0
shader = ExtResource("1_pk3sx")
shader_parameter/enable = true
shader_parameter/albedo_color = Color(1, 0, 0, 1)

14
src/enemy/EnemyStats.cs Normal file
View File

@@ -0,0 +1,14 @@
using Godot;
namespace GameJamDungeon
{
[GlobalClass]
public partial class EnemyStats : Resource
{
[Export(PropertyHint.Range, "0, 100, 1")]
public int MaximumHP = 1;
[Export]
public string Name = string.Empty;
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,197 @@
[gd_scene load_steps=26 format=3 uid="uid://u1vmmakcoplh"]
[ext_resource type="Script" path="res://src/enemy/Enemy.cs" id="1_yhru4"]
[ext_resource type="Texture2D" uid="uid://eqmjpiaec28" path="res://src/enemy/enemy_types/Capricorn/sprites/GameJam_DevilCapricorn_WalkForward.png" id="2_3b07r"]
[ext_resource type="Resource" uid="uid://c5kf3ieosrgvd" path="res://src/enemy/enemy_types/Capricorn/CapricornStats.tres" id="2_8ue4i"]
[ext_resource type="Texture2D" uid="uid://cpkmabfmq1jdm" path="res://src/enemy/enemy_types/Capricorn/sprites/GameJam_DevilCapricorn_WalkBehind.png" id="3_jdsw3"]
[ext_resource type="Texture2D" uid="uid://oilac84w30et" path="res://src/enemy/enemy_types/Capricorn/sprites/GameJam_DevilCapricorn_WalkSide.png" id="5_lrinq"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_p0yqe"]
radius = 1.0
[sub_resource type="SphereShape3D" id="SphereShape3D_3pxe5"]
radius = 5.0
[sub_resource type="SphereShape3D" id="SphereShape3D_fva4b"]
radius = 7.0
[sub_resource type="AtlasTexture" id="AtlasTexture_blequ"]
atlas = ExtResource("3_jdsw3")
region = Rect2(0, 0, 120, 132)
[sub_resource type="AtlasTexture" id="AtlasTexture_w44el"]
atlas = ExtResource("3_jdsw3")
region = Rect2(120, 0, 120, 132)
[sub_resource type="AtlasTexture" id="AtlasTexture_r7t7r"]
atlas = ExtResource("3_jdsw3")
region = Rect2(240, 0, 120, 132)
[sub_resource type="AtlasTexture" id="AtlasTexture_6f3e5"]
atlas = ExtResource("3_jdsw3")
region = Rect2(360, 0, 120, 132)
[sub_resource type="AtlasTexture" id="AtlasTexture_hxlca"]
atlas = ExtResource("2_3b07r")
region = Rect2(0, 0, 120, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_gkjrg"]
atlas = ExtResource("2_3b07r")
region = Rect2(120, 0, 120, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_tuwxc"]
atlas = ExtResource("2_3b07r")
region = Rect2(240, 0, 120, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_ox6nd"]
atlas = ExtResource("2_3b07r")
region = Rect2(360, 0, 120, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_846f4"]
atlas = ExtResource("5_lrinq")
region = Rect2(0, 0, 113, 130)
[sub_resource type="AtlasTexture" id="AtlasTexture_ne5m6"]
atlas = ExtResource("5_lrinq")
region = Rect2(113, 0, 113, 130)
[sub_resource type="AtlasTexture" id="AtlasTexture_0fsup"]
atlas = ExtResource("5_lrinq")
region = Rect2(226, 0, 113, 130)
[sub_resource type="AtlasTexture" id="AtlasTexture_6ubx5"]
atlas = ExtResource("5_lrinq")
region = Rect2(339, 0, 113, 130)
[sub_resource type="AtlasTexture" id="AtlasTexture_0q2sf"]
atlas = ExtResource("5_lrinq")
region = Rect2(0, 0, 113, 130)
[sub_resource type="AtlasTexture" id="AtlasTexture_ttv6x"]
atlas = ExtResource("5_lrinq")
region = Rect2(113, 0, 113, 130)
[sub_resource type="AtlasTexture" id="AtlasTexture_blw0y"]
atlas = ExtResource("5_lrinq")
region = Rect2(226, 0, 113, 130)
[sub_resource type="AtlasTexture" id="AtlasTexture_40mal"]
atlas = ExtResource("5_lrinq")
region = Rect2(339, 0, 113, 130)
[sub_resource type="SpriteFrames" id="SpriteFrames_nk8av"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_blequ")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_w44el")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_r7t7r")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6f3e5")
}],
"loop": true,
"name": &"walk_backward",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_hxlca")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gkjrg")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tuwxc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ox6nd")
}],
"loop": true,
"name": &"walk_forward",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_846f4")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ne5m6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0fsup")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6ubx5")
}],
"loop": true,
"name": &"walk_left",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_0q2sf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ttv6x")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_blw0y")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_40mal")
}],
"loop": true,
"name": &"walk_right",
"speed": 5.0
}]
[node name="Capricorn" type="CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, 0)
collision_layer = 10
collision_mask = 9
script = ExtResource("1_yhru4")
EnemyStats = ExtResource("2_8ue4i")
[node name="NavigationAgent3D" type="NavigationAgent3D" parent="."]
unique_name_in_owner = true
radius = 5.0
debug_enabled = true
debug_path_custom_color = Color(1, 0, 0, 1)
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 1.06581e-14, 0, 1, 0, -1.06581e-14, 0, 1, 0, 0, 0)
shape = SubResource("CapsuleShape3D_p0yqe")
disabled = true
[node name="DetectionSphere" type="Area3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(0.707107, 0, -0.707107, 0, 1, 0, 0.707107, 0, 0.707107, 0.689022, 0, -2.13941)
collision_layer = 0
collision_mask = 32
[node name="CollisionShape3D" type="CollisionShape3D" parent="DetectionSphere"]
shape = SubResource("SphereShape3D_3pxe5")
[node name="AlertedSphere" type="Area3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(0.707107, 0, -0.707107, 0, 1, 0, 0.707107, 0, 0.707107, 0.689022, 0, -2.13941)
collision_layer = 0
collision_mask = 32
[node name="CollisionShape3D" type="CollisionShape3D" parent="AlertedSphere"]
shape = SubResource("SphereShape3D_fva4b")
[node name="Sprite" type="AnimatedSprite3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
flip_h = true
pixel_size = 0.015
billboard = 2
double_sided = false
sprite_frames = SubResource("SpriteFrames_nk8av")
animation = &"walk_forward"

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="EnemyStats" load_steps=2 format=3 uid="uid://c5kf3ieosrgvd"]
[ext_resource type="Script" path="res://src/enemy/EnemyStats.cs" id="1_u8ynp"]
[resource]
script = ExtResource("1_u8ynp")
MaximumHP = 3
Name = "Capricorn"

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dk2ycv2xtbo02"
path.s3tc="res://.godot/imported/GameJam_DevilCapricorn_AttackBehind.png-4a62504071b0b47b4c44701576f28b71.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://src/enemy/enemy_types/Capricorn/sprites/GameJam_DevilCapricorn_AttackBehind.png"
dest_files=["res://.godot/imported/GameJam_DevilCapricorn_AttackBehind.png-4a62504071b0b47b4c44701576f28b71.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bokwgppcplsi2"
path="res://.godot/imported/GameJam_DevilCapricorn_AttackForward.png-19afa006891b4fec91bc5fa4f7ab34c1.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/enemy/enemy_types/Capricorn/sprites/GameJam_DevilCapricorn_AttackForward.png"
dest_files=["res://.godot/imported/GameJam_DevilCapricorn_AttackForward.png-19afa006891b4fec91bc5fa4f7ab34c1.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dai11mxf46bre"
path="res://.godot/imported/GameJam_DevilCapricorn_AttackSide.png-0b945747d711f802066903b1955f3609.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/enemy/enemy_types/Capricorn/sprites/GameJam_DevilCapricorn_AttackSide.png"
dest_files=["res://.godot/imported/GameJam_DevilCapricorn_AttackSide.png-0b945747d711f802066903b1955f3609.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cpkmabfmq1jdm"
path.s3tc="res://.godot/imported/GameJam_DevilCapricorn_WalkBehind.png-ea8bd0f4c2f40d539ea76c4328aaca1c.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://src/enemy/enemy_types/Capricorn/sprites/GameJam_DevilCapricorn_WalkBehind.png"
dest_files=["res://.godot/imported/GameJam_DevilCapricorn_WalkBehind.png-ea8bd0f4c2f40d539ea76c4328aaca1c.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://eqmjpiaec28"
path.s3tc="res://.godot/imported/GameJam_DevilCapricorn_WalkForward.png-a3c524fe98aeca30d5381eb3a545e447.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://src/enemy/enemy_types/Capricorn/sprites/GameJam_DevilCapricorn_WalkForward.png"
dest_files=["res://.godot/imported/GameJam_DevilCapricorn_WalkForward.png-a3c524fe98aeca30d5381eb3a545e447.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://oilac84w30et"
path.s3tc="res://.godot/imported/GameJam_DevilCapricorn_WalkSide.png-7b4120788f827c03fe7a77d9caecf91c.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://src/enemy/enemy_types/Capricorn/sprites/GameJam_DevilCapricorn_WalkSide.png"
dest_files=["res://.godot/imported/GameJam_DevilCapricorn_WalkSide.png-7b4120788f827c03fe7a77d9caecf91c.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,36 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://cli0nlukrd4dc"
path="res://.godot/imported/DISSAPPEARING ENEMY.gltf-86890683bfa8a9cc2bc15c917a019516.scn"
[deps]
source_file="res://src/enemy/enemy_types/DISSAPPEARING ENEMY.gltf"
dest_files=["res://.godot/imported/DISSAPPEARING ENEMY.gltf-86890683bfa8a9cc2bc15c917a019516.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={}
gltf/naming_version=1
gltf/embedded_image_handling=1

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="EnemyStats" load_steps=2 format=3 uid="uid://bcsyqy7rmbpbl"]
[ext_resource type="Script" path="res://src/enemy/EnemyStats.cs" id="1_0ks7j"]
[resource]
script = ExtResource("1_0ks7j")
MaximumHP = 12
Name = "Floating Guy"

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,16 @@
namespace GameJamDungeon
{
public partial class EnemyLogic
{
public static class Input
{
public readonly record struct Alerted();
public readonly record struct LostPlayer();
public readonly record struct PhysicsTick(double Delta);
public readonly record struct HitByPlayer();
}
}
}

View File

@@ -0,0 +1,18 @@
using Godot;
namespace GameJamDungeon
{
public partial class EnemyLogic
{
public static class Output
{
public readonly record struct MoveTowardsPlayer(Vector3 TargetPosition);
public readonly record struct MovementComputed(Vector3 Velocity);
public readonly record struct HitByPlayer(int CurrentHP);
public readonly record struct Die();
}
}
}

View File

@@ -0,0 +1,7 @@
namespace GameJamDungeon
{
public partial class EnemyLogic
{
public record Settings(float MaximumHP);
}
}

View File

@@ -0,0 +1,16 @@
using Chickensoft.Introspection;
using Chickensoft.LogicBlocks;
namespace GameJamDungeon
{
public partial class EnemyLogic
{
[Meta]
public abstract partial record State : StateLogic<State>
{
protected State()
{
}
}
}
}

View File

@@ -0,0 +1,14 @@
using Chickensoft.Introspection;
using Chickensoft.LogicBlocks;
namespace GameJamDungeon
{
public interface IEnemyLogic : ILogicBlock<EnemyLogic.State>;
[Meta, Id("enemy_logic")]
[LogicBlock(typeof(State), Diagram = true)]
public partial class EnemyLogic : LogicBlock<EnemyLogic.State>, IEnemyLogic
{
public override Transition GetInitialState() => To<State.Idle>();
}
}

View File

@@ -0,0 +1,31 @@
using Chickensoft.Introspection;
using Godot;
namespace GameJamDungeon
{
public partial class EnemyLogic
{
public partial record State
{
[Meta, Id("enemy_logic_state_alive")]
public abstract partial record Alive : State, IGet<Input.HitByPlayer>
{
public Transition On(in Input.HitByPlayer _)
{
var enemy = Get<IEnemy>();
var gameRepo = Get<IGameRepo>();
enemy.CurrentHP -= gameRepo.EquippedWeapon.InventoryInfo.Damage;
GD.Print("Current HP: " + enemy.CurrentHP);
GD.Print($"Hit by {gameRepo.EquippedWeapon.Name}");
Output(new Output.HitByPlayer());
if (enemy.CurrentHP <= 0)
Output(new Output.Die());
Input(new Input.Alerted());
return ToSelf();
}
}
}
}
}

View File

@@ -0,0 +1,30 @@
using Chickensoft.Introspection;
using Godot;
namespace GameJamDungeon
{
public partial class EnemyLogic
{
public partial record State
{
[Meta, Id("enemy_logic_state_followplayer")]
public partial record FollowPlayer : Alive, IGet<Input.PhysicsTick>, IGet<Input.LostPlayer>
{
public Transition On(in Input.PhysicsTick input)
{
var delta = input.Delta;
var gameRepo = Get<IGameRepo>();
var enemy = Get<IEnemy>();
Output(new Output.MovementComputed(enemy.Velocity));
return ToSelf();
}
public Transition On(in Input.LostPlayer input)
{
return To<Idle>();
}
}
}
}
}

View File

@@ -0,0 +1,27 @@
using Chickensoft.Introspection;
using Godot;
namespace GameJamDungeon;
public partial class EnemyLogic
{
public partial record State
{
[Meta, Id("enemy_logic_state_idle")]
public partial record Idle : Alive, IGet<Input.Alerted>, IGet<Input.PhysicsTick>
{
public Transition On(in Input.Alerted _)
{
return To<FollowPlayer>();
}
public Transition On(in Input.PhysicsTick input)
{
var delta = input.Delta;
var gameRepo = Get<IGameRepo>();
var enemy = Get<IEnemy>();
return ToSelf();
}
}
}
}

View File

@@ -1,11 +1,10 @@
[gd_scene load_steps=11 format=3 uid="uid://33ek675mfb5n"] [gd_scene load_steps=10 format=3 uid="uid://33ek675mfb5n"]
[ext_resource type="Script" path="res://src/game/Game.cs" id="1_ytcii"] [ext_resource type="Script" path="res://src/game/Game.cs" id="1_ytcii"]
[ext_resource type="PackedScene" uid="uid://wg25dg65ksgg" path="res://src/map/dungeon/DungeonGenerator.tscn" id="2_cgboj"] [ext_resource type="PackedScene" uid="uid://wg25dg65ksgg" path="res://src/map/dungeon/DungeonGenerator.tscn" id="2_cgboj"]
[ext_resource type="PackedScene" uid="uid://cfecvvav8kkp6" path="res://src/player/Player.tscn" id="3_kk6ly"] [ext_resource type="PackedScene" uid="uid://cfecvvav8kkp6" path="res://src/player/Player.tscn" id="3_kk6ly"]
[ext_resource type="PackedScene" uid="uid://dhpwwqow1ahrc" path="res://src/map/dungeon/rooms/Room1.tscn" id="4_56rmd"] [ext_resource type="PackedScene" uid="uid://dhpwwqow1ahrc" path="res://src/map/dungeon/rooms/Room1.tscn" id="4_56rmd"]
[ext_resource type="PackedScene" uid="uid://bbwgmqy3evhh2" path="res://src/map/dungeon/rooms/Room2.tscn" id="4_clpvl"] [ext_resource type="PackedScene" uid="uid://bbwgmqy3evhh2" path="res://src/map/dungeon/rooms/Room2.tscn" id="4_clpvl"]
[ext_resource type="PackedScene" uid="uid://bn4gslp2gk8ds" path="res://src/map/dungeon/corridor/Corridor.tscn" id="6_aur0q"]
[ext_resource type="PackedScene" uid="uid://bwbofurcvf3yh" path="res://src/minimap/Minimap.tscn" id="6_owlf4"] [ext_resource type="PackedScene" uid="uid://bwbofurcvf3yh" path="res://src/minimap/Minimap.tscn" id="6_owlf4"]
[sub_resource type="Environment" id="Environment_fke5g"] [sub_resource type="Environment" id="Environment_fke5g"]
@@ -20,125 +19,6 @@ size = Vector3(10, 1, 10)
process_mode = 3 process_mode = 3
script = ExtResource("1_ytcii") script = ExtResource("1_ytcii")
[node name="DungeonGenerator3D" parent="." instance=ExtResource("2_cgboj")]
room_scenes = Array[PackedScene]([ExtResource("4_56rmd"), ExtResource("4_clpvl")])
corridor_cost_multiplier = 1.0
room_cost_multiplier = 8.0
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(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, 15, 0, 5)
[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="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, 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, 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, -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, -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, -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="."] [node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_fke5g") environment = SubResource("Environment_fke5g")
@@ -165,3 +45,9 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 24.5244, 0)
layers = 3 layers = 3
omni_range = 163.618 omni_range = 163.618
omni_attenuation = -0.183 omni_attenuation = -0.183
[node name="DungeonGenerator3D" parent="." instance=ExtResource("2_cgboj")]
room_scenes = Array[PackedScene]([ExtResource("4_56rmd"), ExtResource("4_clpvl")])
corridor_cost_multiplier = 1.0
room_cost_multiplier = 8.0
room_cost_at_end_for_required_doors = 1.0

View File

@@ -22,6 +22,12 @@ public interface IGameRepo : IDisposable
IAutoProp<Vector3> PlayerGlobalPosition { get; } IAutoProp<Vector3> PlayerGlobalPosition { get; }
void SetPlayerGlobalPosition(Vector3 playerGlobalPosition); void SetPlayerGlobalPosition(Vector3 playerGlobalPosition);
void SetNavigationRegion(NavigationRegion3D region);
IAutoProp<NavigationRegion3D> NavigationRegion3D { get; }
public Weapon EquippedWeapon { get; }
} }
public class GameRepo : IGameRepo public class GameRepo : IGameRepo
@@ -41,6 +47,12 @@ public class GameRepo : IGameRepo
public IAutoProp<bool> IsPaused => _isPaused; public IAutoProp<bool> IsPaused => _isPaused;
private readonly AutoProp<bool> _isPaused; private readonly AutoProp<bool> _isPaused;
private Weapon _equippedWeapon;
public Weapon EquippedWeapon => _equippedWeapon;
private AutoProp<NavigationRegion3D> _navigationRegion3D;
public IAutoProp<NavigationRegion3D> NavigationRegion3D => _navigationRegion3D;
private bool _disposedValue; private bool _disposedValue;
public GameRepo() public GameRepo()
@@ -49,6 +61,8 @@ public class GameRepo : IGameRepo
_isInventoryScreenOpened = new AutoProp<bool>(false); _isInventoryScreenOpened = new AutoProp<bool>(false);
_isPaused = new AutoProp<bool>(false); _isPaused = new AutoProp<bool>(false);
_playerGlobalPosition = new AutoProp<Vector3>(Vector3.Zero); _playerGlobalPosition = new AutoProp<Vector3>(Vector3.Zero);
_equippedWeapon = new Weapon() { InventoryInfo = WeaponInfo.Default };
_navigationRegion3D = new AutoProp<NavigationRegion3D>(new NavigationRegion3D());
} }
public void Pause() public void Pause()
@@ -65,6 +79,8 @@ public class GameRepo : IGameRepo
public void SetPlayerGlobalPosition(Vector3 playerGlobalPosition) => _playerGlobalPosition.OnNext(playerGlobalPosition); public void SetPlayerGlobalPosition(Vector3 playerGlobalPosition) => _playerGlobalPosition.OnNext(playerGlobalPosition);
public void SetNavigationRegion(NavigationRegion3D region) => _navigationRegion3D.OnNext(region);
public void OnGameEnded() public void OnGameEnded()
{ {
Pause(); Pause();

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://bn4gslp2gk8ds"] [gd_scene load_steps=6 format=3 uid="uid://bn4gslp2gk8ds"]
[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_y0rqi"] [ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_y0rqi"]
[ext_resource type="PackedScene" uid="uid://ckaw6wjmi0fom" path="res://src/map/dungeon/door/Door.tscn" id="2_vpnlr"] [ext_resource type="PackedScene" uid="uid://ckaw6wjmi0fom" path="res://src/map/dungeon/door/Door.tscn" id="2_vpnlr"]
@@ -10,12 +10,12 @@ albedo_color = Color(1, 1, 0, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_qay2n"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_qay2n"]
albedo_color = Color(1, 1, 0, 1) albedo_color = Color(1, 1, 0, 1)
[sub_resource type="PlaneMesh" id="PlaneMesh_7myha"]
size = Vector2(10, 10)
[node name="Corridor" type="Node3D"] [node name="Corridor" type="Node3D"]
script = ExtResource("1_y0rqi") script = ExtResource("1_y0rqi")
[node name="RemoveUnusedDoors" type="Node" parent="."]
script = ExtResource("3_8i1ij")
[node name="CSGBox3D" type="CSGBox3D" parent="."] [node name="CSGBox3D" type="CSGBox3D" parent="."]
use_collision = true use_collision = true
size = Vector3(10, 10, 10) size = Vector3(10, 10, 10)
@@ -28,20 +28,16 @@ material = SubResource("StandardMaterial3D_qay2n")
[node name="DOOR?4" parent="CSGBox3D" instance=ExtResource("2_vpnlr")] [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) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.58627, 5)
size = Vector3(4, 4, 1)
[node name="DOOR?5" parent="CSGBox3D" instance=ExtResource("2_vpnlr")] [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) transform = Transform3D(-0.0899894, 0, 0.995943, 0, 1, 0, -0.995943, 0, -0.0899894, -4.7076, -2.586, 0)
size = Vector3(4, 4, 1)
[node name="DOOR?6" parent="CSGBox3D" instance=ExtResource("2_vpnlr")] [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) transform = Transform3D(-0.0899894, 0, 0.995943, 0, 1, 0, -0.995943, 0, -0.0899894, 4.73741, -2.586, 0)
size = Vector3(4, 4, 1)
[node name="DOOR?2" parent="CSGBox3D" instance=ExtResource("2_vpnlr")] [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) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.58627, -5)
size = Vector3(4, 4, 1)
[node name="RemoveUnusedDoors" type="Node" parent="."]
script = ExtResource("3_8i1ij")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4.56974, 0)
layers = 2
mesh = SubResource("PlaneMesh_7myha")

View File

@@ -25,8 +25,12 @@ public partial class DungeonRoom : Node3D, IDungeonRoom, IProvide<DungeonRoomLog
[Node] public Node3D ItemSpawnPoints { get; set; } = default!; [Node] public Node3D ItemSpawnPoints { get; set; } = default!;
[Node] public Node3D EnemySpawnPoints { get; set; } = default!;
[Node] public ItemDatabase ItemDatabase { get; set; } = default!; [Node] public ItemDatabase ItemDatabase { get; set; } = default!;
[Node] public EnemyDatabase EnemyDatabase { get; set; } = default!;
public DungeonRoomLogic.IBinding DungeonRoomBinding { get; set; } = default!; public DungeonRoomLogic.IBinding DungeonRoomBinding { get; set; } = default!;
public void Setup() public void Setup()
@@ -34,10 +38,11 @@ public partial class DungeonRoom : Node3D, IDungeonRoom, IProvide<DungeonRoomLog
DungeonRoomLogic = new DungeonRoomLogic(); DungeonRoomLogic = new DungeonRoomLogic();
DungeonRoomLogic.Set(this as IDungeonRoom); DungeonRoomLogic.Set(this as IDungeonRoom);
DungeonRoomLogic.Set(GameRepo); DungeonRoomLogic.Set(GameRepo);
PopulateRoom(); SpawnItems();
SpawnEnemies();
} }
private void PopulateRoom() private void SpawnItems()
{ {
var itemSpawnPoints = ItemSpawnPoints.GetChildren(); var itemSpawnPoints = ItemSpawnPoints.GetChildren();
var rng = new RandomNumberGenerator(); var rng = new RandomNumberGenerator();
@@ -58,6 +63,26 @@ public partial class DungeonRoom : Node3D, IDungeonRoom, IProvide<DungeonRoomLog
} }
} }
private void SpawnEnemies()
{
var rng = new RandomNumberGenerator();
rng.Randomize();
var enemySpawnPoints = EnemySpawnPoints.GetChildren();
var numberOfEnemiesToSpawn = rng.RandiRange(1, enemySpawnPoints.Count);
foreach (Marker3D spawnPoint in enemySpawnPoints)
{
if (numberOfEnemiesToSpawn <= 0)
break;
numberOfEnemiesToSpawn--;
var enemy = EnemyDatabase.EnemyList[rng.RandWeighted(EnemyDatabase.SpawnRate)];
var instantiatedEnemy = enemy.Instantiate<Enemy>();
instantiatedEnemy.Position = spawnPoint.Position;
AddChild(instantiatedEnemy);
}
}
public void OnResolved() public void OnResolved()
{ {
DungeonRoomBinding = DungeonRoomLogic.Bind(); DungeonRoomBinding = DungeonRoomLogic.Bind();

View File

@@ -1,9 +1,12 @@
[gd_scene load_steps=10 format=3 uid="uid://dhpwwqow1ahrc"] [gd_scene load_steps=13 format=3 uid="uid://dhpwwqow1ahrc"]
[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_0tfda"] [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="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="PackedScene" uid="uid://ckaw6wjmi0fom" path="res://src/map/dungeon/door/Door.tscn" id="2_mdawx"]
[ext_resource type="PackedScene" uid="uid://twrj4wixcbu7" path="res://src/items/ItemDatabase.tscn" id="4_2mnb7"] [ext_resource type="PackedScene" uid="uid://twrj4wixcbu7" path="res://src/items/ItemDatabase.tscn" id="4_2mnb7"]
[ext_resource type="PackedScene" uid="uid://dbvr8ewajja6a" path="res://src/enemy/EnemyDatabase.tscn" id="5_owpbq"]
[ext_resource type="PackedScene" uid="uid://dcgj5i52i76gj" path="res://src/enemy/enemy_types/FloatingEnemy.tscn" id="5_urvkv"]
[ext_resource type="PackedScene" uid="uid://u1vmmakcoplh" path="res://src/enemy/enemy_types/Capricorn/Capricorn.tscn" id="6_hp0mx"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nin6j"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nin6j"]
albedo_color = Color(1, 0, 0.0784314, 1) albedo_color = Color(1, 0, 0.0784314, 1)
@@ -23,9 +26,6 @@ size = Vector2(10, 10)
[node name="DungeonRoom3D" type="Node3D"] [node name="DungeonRoom3D" type="Node3D"]
script = ExtResource("1_0tfda") script = ExtResource("1_0tfda")
[node name="DungeonRoom" type="Node3D" parent="."]
script = ExtResource("1_ti7ur")
[node name="CSGBox3D" type="CSGBox3D" parent="."] [node name="CSGBox3D" type="CSGBox3D" parent="."]
use_collision = true use_collision = true
size = Vector3(10, 10, 10) size = Vector3(10, 10, 10)
@@ -38,13 +38,18 @@ size = Vector3(9, 9, 9)
material = SubResource("StandardMaterial3D_5j6ws") material = SubResource("StandardMaterial3D_5j6ws")
[node name="DOOR" parent="CSGBox3D" instance=ExtResource("2_mdawx")] [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) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.563568, -2.54039, 4.74571)
size = Vector3(4, 4, 1)
material = SubResource("StandardMaterial3D_it7n4") material = SubResource("StandardMaterial3D_it7n4")
[node name="DOOR2" parent="CSGBox3D" instance=ExtResource("2_mdawx")] [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) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.58282, -4.73548)
size = Vector3(4, 4, 1)
material = SubResource("StandardMaterial3D_05l2p") material = SubResource("StandardMaterial3D_05l2p")
[node name="DungeonRoom" type="Node3D" parent="."]
script = ExtResource("1_ti7ur")
[node name="PlayerSpawn" type="Marker3D" parent="."] [node name="PlayerSpawn" type="Marker3D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
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.23461, 0)
@@ -61,5 +66,16 @@ unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.54295, -4.48909, -2.92704) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.54295, -4.48909, -2.92704)
gizmo_extents = 1.0 gizmo_extents = 1.0
[node name="EnemySpawnPoints" type="Node3D" parent="."]
unique_name_in_owner = true
[node name="EnemySpawn1" type="Marker3D" parent="EnemySpawnPoints"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.053, -3.59858, 0)
[node name="ItemDatabase" parent="." instance=ExtResource("4_2mnb7")] [node name="ItemDatabase" parent="." instance=ExtResource("4_2mnb7")]
unique_name_in_owner = true unique_name_in_owner = true
[node name="EnemyDatabase" parent="." instance=ExtResource("5_owpbq")]
unique_name_in_owner = true
EnemyList = Array[PackedScene]([ExtResource("5_urvkv"), ExtResource("6_hp0mx")])
SpawnRate = PackedFloat32Array(0.1, 0.9)

View File

@@ -1,9 +1,13 @@
[gd_scene load_steps=10 format=3 uid="uid://bbwgmqy3evhh2"] [gd_scene load_steps=11 format=3 uid="uid://bbwgmqy3evhh2"]
[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_o02dd"] [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="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://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"] [ext_resource type="PackedScene" uid="uid://ckaw6wjmi0fom" path="res://src/map/dungeon/door/Door.tscn" id="4_nh0nj"]
[ext_resource type="PackedScene" uid="uid://dbvr8ewajja6a" path="res://src/enemy/EnemyDatabase.tscn" id="5_fabiq"]
[sub_resource type="PlaneMesh" id="PlaneMesh_j8q3j"]
size = Vector2(50, 10)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_b8kax"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_b8kax"]
albedo_color = Color(0.0470588, 0, 1, 1) albedo_color = Color(0.0470588, 0, 1, 1)
@@ -17,9 +21,6 @@ albedo_color = Color(0.0470588, 0, 1, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ham86"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ham86"]
albedo_color = Color(0.0470588, 0, 1, 1) albedo_color = Color(0.0470588, 0, 1, 1)
[sub_resource type="PlaneMesh" id="PlaneMesh_j8q3j"]
size = Vector2(50, 10)
[node name="DungeonRoom3D" type="Node3D"] [node name="DungeonRoom3D" type="Node3D"]
script = ExtResource("1_o02dd") script = ExtResource("1_o02dd")
size_in_voxels = Vector3i(5, 1, 1) size_in_voxels = Vector3i(5, 1, 1)
@@ -27,26 +28,6 @@ size_in_voxels = Vector3i(5, 1, 1)
[node name="DungeonRoom" type="Node3D" parent="."] [node name="DungeonRoom" type="Node3D" parent="."]
script = ExtResource("2_jrlll") script = ExtResource("2_jrlll")
[node name="CSGBox3D" type="CSGBox3D" parent="."]
use_collision = true
size = Vector3(50, 10, 10)
material = SubResource("StandardMaterial3D_b8kax")
[node name="CSGBox3D2" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0493774, 0, 0)
operation = 2
use_collision = true
size = Vector3(49, 9, 9)
material = SubResource("StandardMaterial3D_1h648")
[node name="DOOR" parent="CSGBox3D" instance=ExtResource("4_nh0nj")]
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(-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="."] [node name="PlayerSpawn" type="Marker3D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
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.23461, 0)
@@ -71,6 +52,10 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -16.3726, -4.48909, 2.87214)
gizmo_extents = 1.0 gizmo_extents = 1.0
[node name="EnemySpawnPoints" type="Node3D" parent="."] [node name="EnemySpawnPoints" type="Node3D" parent="."]
unique_name_in_owner = true
[node name="EnemySpawn1" type="Marker3D" parent="EnemySpawnPoints"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.833, -3.72961, 0)
[node name="Minimap Texture" type="MeshInstance3D" parent="."] [node name="Minimap Texture" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4.50433, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4.50433, 0)
@@ -79,3 +64,28 @@ mesh = SubResource("PlaneMesh_j8q3j")
[node name="ItemDatabase" parent="." instance=ExtResource("4_c51bx")] [node name="ItemDatabase" parent="." instance=ExtResource("4_c51bx")]
unique_name_in_owner = true unique_name_in_owner = true
[node name="EnemyDatabase" parent="." instance=ExtResource("5_fabiq")]
unique_name_in_owner = true
[node name="CSGBox3D" type="CSGBox3D" parent="."]
use_collision = true
size = Vector3(50, 10, 10)
material = SubResource("StandardMaterial3D_b8kax")
[node name="CSGBox3D2" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0493774, 0, 0)
operation = 2
use_collision = true
size = Vector3(49, 9, 9)
material = SubResource("StandardMaterial3D_1h648")
[node name="DOOR" parent="CSGBox3D" instance=ExtResource("4_nh0nj")]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 25, -2.5, 0)
size = Vector3(4, 4, 1)
material = SubResource("StandardMaterial3D_u3mvg")
[node name="DOOR2" parent="CSGBox3D" instance=ExtResource("4_nh0nj")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -24.578, -2.5, 0)
size = Vector3(4, 4, 1)
material = SubResource("StandardMaterial3D_ham86")

View File

@@ -108,6 +108,11 @@ animations = [{
[sub_resource type="BoxShape3D" id="BoxShape3D_wedu3"] [sub_resource type="BoxShape3D" id="BoxShape3D_wedu3"]
[node name="Player" type="CharacterBody3D"] [node name="Player" type="CharacterBody3D"]
collision_layer = 38
collision_mask = 7
axis_lock_linear_y = true
axis_lock_angular_x = true
axis_lock_angular_z = true
motion_mode = 1 motion_mode = 1
script = ExtResource("1_xcol5") script = ExtResource("1_xcol5")
RotationSpeed = 0.025 RotationSpeed = 0.025
@@ -120,7 +125,7 @@ shape = SubResource("CapsuleShape3D_dw45s")
mesh = SubResource("CapsuleMesh_dmans") mesh = SubResource("CapsuleMesh_dmans")
[node name="Camera3D" type="Camera3D" parent="."] [node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.46709, -0.511194) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.36136, -0.472795)
cull_mask = 1048573 cull_mask = 1048573
[node name="OmniLight3D" type="OmniLight3D" parent="."] [node name="OmniLight3D" type="OmniLight3D" parent="."]

View File

@@ -33,6 +33,7 @@ namespace GameJamDungeon
{ {
var gameRepo = Get<IGameRepo>(); var gameRepo = Get<IGameRepo>();
gameRepo.SetPlayerGlobalPosition(input.GlobalPosition); gameRepo.SetPlayerGlobalPosition(input.GlobalPosition);
GD.Print($"Current position: {input.GlobalPosition}");
return ToSelf(); return ToSelf();
} }
} }

BIN
src/sfx/SE_BTL_BKN_10.ogg Normal file

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://cnsw6x70aawoc"
path="res://.godot/imported/SE_BTL_BKN_10.ogg-f6ec6e0e609e9f325bcd12539236b4be.oggvorbisstr"
[deps]
source_file="res://src/sfx/SE_BTL_BKN_10.ogg"
dest_files=["res://.godot/imported/SE_BTL_BKN_10.ogg-f6ec6e0e609e9f325bcd12539236b4be.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

BIN
src/sfx/SE_BTL_BKN_21.ogg Normal file

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://d5tquxahydiy"
path="res://.godot/imported/SE_BTL_BKN_21.ogg-18929f982e62102e29a8439d9e3e6246.oggvorbisstr"
[deps]
source_file="res://src/sfx/SE_BTL_BKN_21.ogg"
dest_files=["res://.godot/imported/SE_BTL_BKN_21.ogg-18929f982e62102e29a8439d9e3e6246.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

BIN
src/sfx/swish-7.wav Normal file

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://d2pubs2jbnkn5"
path="res://.godot/imported/swish-7.wav-68bc23f9c7120de3e54b25a21082a686.sample"
[deps]
source_file="res://src/sfx/swish-7.wav"
dest_files=["res://.godot/imported/swish-7.wav-68bc23f9c7120de3e54b25a21082a686.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0