Rough collision avoidance implementation using pre-generated floors (just floor 01)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene load_steps=9 format=3 uid="uid://bn6lta2vs6qh8"]
|
[gd_scene load_steps=9 format=3 uid="uid://bn6lta2vs6qh8"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_m0wvh"]
|
[ext_resource type="Script" uid="uid://ce73fuh74l81l" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_m0wvh"]
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_8tlf5"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_8tlf5"]
|
||||||
albedo_color = Color(0, 0, 0, 1)
|
albedo_color = Color(0, 0, 0, 1)
|
||||||
|
|||||||
@@ -210,6 +210,11 @@ locale/translations_pot_files=PackedStringArray("res://src/dialog/Dialogue.dialo
|
|||||||
3d_physics/layer_10="Minimap"
|
3d_physics/layer_10="Minimap"
|
||||||
3d_physics/layer_11="ItemRescue"
|
3d_physics/layer_11="ItemRescue"
|
||||||
3d_physics/layer_12="EnemyHitbox"
|
3d_physics/layer_12="EnemyHitbox"
|
||||||
|
3d_physics/layer_32="Navigation"
|
||||||
|
|
||||||
|
[navigation]
|
||||||
|
|
||||||
|
3d/default_cell_height=1.0
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ public partial class BossLogic
|
|||||||
var boss = Get<IBoss>();
|
var boss = Get<IBoss>();
|
||||||
var player = Get<IPlayer>();
|
var player = Get<IPlayer>();
|
||||||
var delta = (float)input.Delta;
|
var delta = (float)input.Delta;
|
||||||
var playerPosition = new Vector3(player.CurrentPosition.X, boss.GlobalPosition.Y, player.CurrentPosition.Z);
|
|
||||||
var targetDirection = boss.GlobalPosition - player.CurrentPosition;
|
var targetDirection = boss.GlobalPosition - player.CurrentPosition;
|
||||||
boss.GlobalRotation = new Vector3(boss.GlobalRotation.X, Mathf.LerpAngle(boss.GlobalRotation.Y, Mathf.Atan2(-targetDirection.X, -targetDirection.Z), delta * 3f), boss.GlobalRotation.Z);
|
boss.GlobalRotation = new Vector3(boss.GlobalRotation.X, Mathf.LerpAngle(boss.GlobalRotation.Y, Mathf.Atan2(-targetDirection.X, -targetDirection.Z), delta * 3f), boss.GlobalRotation.Z);
|
||||||
if (boss.GlobalPosition.DistanceTo(player.CurrentPosition) > 5.0f)
|
if (boss.GlobalPosition.DistanceTo(player.CurrentPosition) > 5.0f)
|
||||||
|
|||||||
@@ -11,11 +11,10 @@ public partial class BossLogic
|
|||||||
{
|
{
|
||||||
public Transition On(in Input.PhysicsTick input)
|
public Transition On(in Input.PhysicsTick input)
|
||||||
{
|
{
|
||||||
var delta = input.Delta;
|
|
||||||
var enemy = Get<IEnemy>();
|
var enemy = Get<IEnemy>();
|
||||||
var player = Get<IPlayer>();
|
var player = Get<IPlayer>();
|
||||||
var target = player.CurrentPosition;
|
var target = player.CurrentPosition;
|
||||||
enemy.MoveToLocation(target, (float)delta);
|
enemy.SetTarget(target);
|
||||||
return ToSelf();
|
return ToSelf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ using Chickensoft.AutoInject;
|
|||||||
using Chickensoft.Collections;
|
using Chickensoft.Collections;
|
||||||
using Chickensoft.Introspection;
|
using Chickensoft.Introspection;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace GameJamDungeon;
|
namespace GameJamDungeon;
|
||||||
|
|
||||||
@@ -22,7 +25,7 @@ public partial class Enemy : RigidBody3D, IEnemy, IProvide<IEnemyLogic>
|
|||||||
|
|
||||||
[Dependency] IGameEventDepot GameEventDepot => this.DependOn<IGameEventDepot>();
|
[Dependency] IGameEventDepot GameEventDepot => this.DependOn<IGameEventDepot>();
|
||||||
|
|
||||||
[Dependency] protected IPlayer Player => this.DependOn<IPlayer>();
|
[Dependency] protected IPlayer Player => this.DependOn<IPlayer>(() => GetParent().GetChildren().OfType<IPlayer>().Single());
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Exports
|
#region Exports
|
||||||
@@ -53,12 +56,51 @@ public partial class Enemy : RigidBody3D, IEnemy, IProvide<IEnemyLogic>
|
|||||||
|
|
||||||
private Vector3 _knockbackDirection = Vector3.Zero;
|
private Vector3 _knockbackDirection = Vector3.Zero;
|
||||||
|
|
||||||
|
private Vector3 _currentTarget = Vector3.Zero;
|
||||||
|
|
||||||
|
private Timer _thinkTimer;
|
||||||
|
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_enemyLogic = new EnemyLogic();
|
_enemyLogic = new EnemyLogic();
|
||||||
_enemyLogic.Set(_enemyStatResource);
|
_enemyLogic.Set(_enemyStatResource);
|
||||||
_enemyLogic.Set(this as IEnemy);
|
_enemyLogic.Set(this as IEnemy);
|
||||||
_enemyLogic.Set(Player);
|
_enemyLogic.Set(Player);
|
||||||
|
|
||||||
|
NavAgent.VelocityComputed += NavAgent_VelocityComputed;
|
||||||
|
NavAgent.TargetReached += NavAgent_TargetReached;
|
||||||
|
|
||||||
|
_thinkTimer = new Timer
|
||||||
|
{
|
||||||
|
WaitTime = 1f
|
||||||
|
};
|
||||||
|
AddChild(_thinkTimer);
|
||||||
|
_thinkTimer.Timeout += NavAgent_TargetReached;
|
||||||
|
_thinkTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NavAgent_TargetReached()
|
||||||
|
{
|
||||||
|
NavAgent.TargetPosition = _currentTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NavAgent_VelocityComputed(Vector3 safeVelocity)
|
||||||
|
{
|
||||||
|
if (CurrentHP <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var lookDir = GlobalPosition - safeVelocity;
|
||||||
|
var leveledLookDir = new Vector3(lookDir.X, Position.Y, lookDir.Z);
|
||||||
|
if (leveledLookDir.DistanceTo(GlobalPosition) > 0.2f)
|
||||||
|
LookAt(new Vector3(lookDir.X, Position.Y, lookDir.Z), Vector3.Up);
|
||||||
|
|
||||||
|
_knockbackStrength = _knockbackStrength * 0.9f;
|
||||||
|
MoveAndCollide(safeVelocity + (_knockbackDirection * _knockbackStrength));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTarget(Vector3 target)
|
||||||
|
{
|
||||||
|
Task.Delay(TimeSpan.FromSeconds(1.5)).ContinueWith(_ => _currentTarget = new Vector3(target.X, -1.75f, target.Z));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TakeDamage(double damage, ElementType elementType, bool isCriticalHit = false, bool ignoreDefense = false, bool ignoreElementalResistance = false)
|
public void TakeDamage(double damage, ElementType elementType, bool isCriticalHit = false, bool ignoreDefense = false, bool ignoreElementalResistance = false)
|
||||||
@@ -80,26 +122,29 @@ public partial class Enemy : RigidBody3D, IEnemy, IProvide<IEnemyLogic>
|
|||||||
|
|
||||||
EnemyModelView.PlayHitAnimation();
|
EnemyModelView.PlayHitAnimation();
|
||||||
_enemyLogic.Input(new EnemyLogic.Input.Alerted());
|
_enemyLogic.Input(new EnemyLogic.Input.Alerted());
|
||||||
|
|
||||||
|
if (Player.EquippedWeapon.Value.WeaponTags.Contains(WeaponTag.SelfDamage))
|
||||||
|
Player.Stats.SetCurrentHP(Player.Stats.CurrentHP.Value - 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MoveToLocation(Vector3 target, float delta)
|
public override void _PhysicsProcess(double delta)
|
||||||
{
|
{
|
||||||
NavAgent.TargetPosition = target;
|
if (CurrentHP <= 0)
|
||||||
var targetPosition = NavAgent.GetNextPathPosition();
|
return;
|
||||||
|
|
||||||
var velocity = (targetPosition - GlobalTransform.Origin).Normalized() * 2f * delta;
|
var nextPathPosition = NavAgent.GetNextPathPosition();
|
||||||
var lookAtDir = GlobalTransform.Origin - velocity;
|
var movementDelta = 2f * (float)delta;
|
||||||
var lookAtPosition = new Vector3(lookAtDir.X, GlobalPosition.Y, lookAtDir.Z);
|
|
||||||
|
|
||||||
if (GlobalPosition.DistanceTo(target) > 1.0f && !velocity.IsEqualApprox(Vector3.Zero) && !Position.IsEqualApprox(lookAtPosition))
|
var newVelocity = GlobalPosition.DirectionTo(nextPathPosition) * movementDelta;
|
||||||
LookAt(lookAtPosition + new Vector3(0.001f, 0.001f, 0.001f), Vector3.Up);
|
|
||||||
|
if (NavAgent.AvoidanceEnabled)
|
||||||
|
NavAgent.Velocity = newVelocity;
|
||||||
|
else
|
||||||
|
NavAgent_VelocityComputed(newVelocity);
|
||||||
|
|
||||||
var isWalking = _enemyLogic.Value is EnemyLogic.State.Patrolling or EnemyLogic.State.FollowPlayer;
|
var isWalking = _enemyLogic.Value is EnemyLogic.State.Patrolling or EnemyLogic.State.FollowPlayer;
|
||||||
|
|
||||||
EnemyModelView.RotateModel(GlobalTransform.Basis, -Player.CurrentBasis.Z, isWalking);
|
EnemyModelView.RotateModel(GlobalTransform.Basis, -Player.CurrentBasis.Z, isWalking);
|
||||||
_knockbackStrength = _knockbackStrength * 0.9f;
|
|
||||||
MoveAndCollide(velocity + (_knockbackDirection * _knockbackStrength));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Knockback(float impulse, Vector3 direction)
|
public void Knockback(float impulse, Vector3 direction)
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ public interface IEnemy : IKillable
|
|||||||
|
|
||||||
public void Knockback(float impulse, Vector3 direction);
|
public void Knockback(float impulse, Vector3 direction);
|
||||||
|
|
||||||
public void MoveToLocation(Vector3 target, float delta);
|
|
||||||
|
|
||||||
public double CurrentHP { get; }
|
public double CurrentHP { get; }
|
||||||
|
|
||||||
public void StartAttackTimer();
|
public void StartAttackTimer();
|
||||||
|
|
||||||
public void StopAttackTimer();
|
public void StopAttackTimer();
|
||||||
|
|
||||||
|
public void SetTarget(Vector3 target);
|
||||||
}
|
}
|
||||||
|
|||||||
8
src/enemy/IKnockbackable.cs
Normal file
8
src/enemy/IKnockbackable.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace GameJamDungeon;
|
||||||
|
|
||||||
|
public interface IKnockbackable
|
||||||
|
{
|
||||||
|
public void Knockback(float impulse, Vector3 direction);
|
||||||
|
}
|
||||||
1
src/enemy/IKnockbackable.cs.uid
Normal file
1
src/enemy/IKnockbackable.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://d7v2jmgpl6u8
|
||||||
@@ -23,7 +23,7 @@ DropsSoulGemChance = 0.75
|
|||||||
metadata/_custom_type_script = ExtResource("2_oln85")
|
metadata/_custom_type_script = ExtResource("2_oln85")
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_cwfph"]
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_cwfph"]
|
||||||
radius = 0.62699
|
radius = 0.3
|
||||||
height = 2.02807
|
height = 2.02807
|
||||||
|
|
||||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_jbgmx"]
|
[sub_resource type="CylinderShape3D" id="CylinderShape3D_jbgmx"]
|
||||||
@@ -40,6 +40,7 @@ collision_layer = 10
|
|||||||
collision_mask = 11
|
collision_mask = 11
|
||||||
axis_lock_linear_y = true
|
axis_lock_linear_y = true
|
||||||
axis_lock_angular_x = true
|
axis_lock_angular_x = true
|
||||||
|
axis_lock_angular_z = true
|
||||||
contact_monitor = true
|
contact_monitor = true
|
||||||
max_contacts_reported = 1
|
max_contacts_reported = 1
|
||||||
script = ExtResource("1_xsluo")
|
script = ExtResource("1_xsluo")
|
||||||
@@ -52,11 +53,14 @@ shape = SubResource("CapsuleShape3D_cwfph")
|
|||||||
|
|
||||||
[node name="NavAgent" type="NavigationAgent3D" parent="."]
|
[node name="NavAgent" type="NavigationAgent3D" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
path_max_distance = 3.01
|
|
||||||
simplify_path = true
|
|
||||||
avoidance_enabled = true
|
avoidance_enabled = true
|
||||||
radius = 2.0
|
radius = 1.5
|
||||||
debug_path_custom_color = Color(1, 0, 0, 1)
|
neighbor_distance = 5.0
|
||||||
|
time_horizon_obstacles = 1.0
|
||||||
|
debug_enabled = true
|
||||||
|
debug_use_custom = true
|
||||||
|
debug_path_custom_color = Color(0.388717, 0.273656, 0.30701, 1)
|
||||||
|
debug_path_custom_point_size = 10.0
|
||||||
|
|
||||||
[node name="LineOfSight" type="Area3D" parent="."]
|
[node name="LineOfSight" type="Area3D" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ height = 5.0
|
|||||||
radius = 1.0
|
radius = 1.0
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_0h5s2"]
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_0h5s2"]
|
||||||
radius = 0.404629
|
radius = 0.3
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_wrps7"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_wrps7"]
|
||||||
radius = 1.0
|
radius = 1.0
|
||||||
@@ -75,7 +75,10 @@ shape = SubResource("CapsuleShape3D_0h5s2")
|
|||||||
|
|
||||||
[node name="NavAgent" type="NavigationAgent3D" parent="."]
|
[node name="NavAgent" type="NavigationAgent3D" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
path_postprocessing = 2
|
||||||
avoidance_enabled = true
|
avoidance_enabled = true
|
||||||
|
radius = 5.0
|
||||||
|
debug_enabled = true
|
||||||
debug_path_custom_color = Color(1, 0, 0, 1)
|
debug_path_custom_color = Color(1, 0, 0, 1)
|
||||||
|
|
||||||
[node name="EnemyModelView" parent="." instance=ExtResource("3_wrps7")]
|
[node name="EnemyModelView" parent="." instance=ExtResource("3_wrps7")]
|
||||||
|
|||||||
@@ -11,11 +11,10 @@ public partial class EnemyLogic
|
|||||||
{
|
{
|
||||||
public Transition On(in Input.PhysicsTick input)
|
public Transition On(in Input.PhysicsTick input)
|
||||||
{
|
{
|
||||||
var delta = input.Delta;
|
|
||||||
var enemy = Get<IEnemy>();
|
var enemy = Get<IEnemy>();
|
||||||
var player = Get<IPlayer>();
|
var player = Get<IPlayer>();
|
||||||
var target = player.CurrentPosition;
|
var target = player.CurrentPosition;
|
||||||
enemy.MoveToLocation(target, (float)delta);
|
enemy.SetTarget(target);
|
||||||
return ToSelf();
|
return ToSelf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Chickensoft.Introspection;
|
using Chickensoft.Introspection;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using Org.BouncyCastle.Asn1.X509;
|
||||||
|
|
||||||
namespace GameJamDungeon;
|
namespace GameJamDungeon;
|
||||||
|
|
||||||
@@ -16,7 +17,7 @@ public partial class EnemyLogic
|
|||||||
{
|
{
|
||||||
var delta = input.Delta;
|
var delta = input.Delta;
|
||||||
var enemy = Get<IEnemy>();
|
var enemy = Get<IEnemy>();
|
||||||
enemy.MoveToLocation(_patrolTarget, (float)delta);
|
enemy.SetTarget(_patrolTarget);
|
||||||
return ToSelf();
|
return ToSelf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,6 @@ public partial class Game : Node3D, IGame
|
|||||||
|
|
||||||
PauseMenu.TransitionCompleted += OnPauseMenuTransitioned;
|
PauseMenu.TransitionCompleted += OnPauseMenuTransitioned;
|
||||||
PauseMenu.UnpauseButtonPressed += PauseMenu_UnpauseButtonPressed;
|
PauseMenu.UnpauseButtonPressed += PauseMenu_UnpauseButtonPressed;
|
||||||
Map.DungeonFinishedGenerating += Map_DungeonFinishedGenerating;
|
|
||||||
InGameUI.InventoryMenu.ClosedMenu += InventoryMenu_CloseInventory;
|
InGameUI.InventoryMenu.ClosedMenu += InventoryMenu_CloseInventory;
|
||||||
InGameUI.MinimapButtonReleased += Player_MinimapButtonReleased;
|
InGameUI.MinimapButtonReleased += Player_MinimapButtonReleased;
|
||||||
|
|
||||||
@@ -274,7 +273,7 @@ public partial class Game : Node3D, IGame
|
|||||||
|
|
||||||
private void InventoryMenu_CloseInventory() => GameLogic.Input(new GameLogic.Input.CloseInventory());
|
private void InventoryMenu_CloseInventory() => GameLogic.Input(new GameLogic.Input.CloseInventory());
|
||||||
|
|
||||||
private void Map_DungeonFinishedGenerating()
|
public void NextFloorLoaded()
|
||||||
{
|
{
|
||||||
var transform = Map.GetPlayerSpawnPosition();
|
var transform = Map.GetPlayerSpawnPosition();
|
||||||
GameRepo.SetPlayerGlobalTransform(transform);
|
GameRepo.SetPlayerGlobalTransform(transform);
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
[gd_scene load_steps=13 format=3 uid="uid://33ek675mfb5n"]
|
[gd_scene load_steps=14 format=3 uid="uid://33ek675mfb5n"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://chftlu4proh3d" path="res://src/game/Game.cs" id="1_ytcii"]
|
[ext_resource type="Script" uid="uid://chftlu4proh3d" path="res://src/game/Game.cs" id="1_ytcii"]
|
||||||
[ext_resource type="Shader" uid="uid://dmjxo4k2rx1an" path="res://src/app/App.gdshader" id="2_6ifxs"]
|
[ext_resource type="Shader" uid="uid://dmjxo4k2rx1an" path="res://src/app/App.gdshader" id="2_6ifxs"]
|
||||||
[ext_resource type="PackedScene" uid="uid://by67pn7fdsg1m" path="res://src/map/Map.tscn" id="3_d8awv"]
|
[ext_resource type="PackedScene" uid="uid://by67pn7fdsg1m" path="res://src/map/Map.tscn" id="3_d8awv"]
|
||||||
[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="Resource" uid="uid://bpdbuf0k0exb5" path="res://src/items/weapons/resources/Sword Sword Odette.tres" id="4_6pp6l"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b1muxus5qdbeu" path="res://src/ui/in_game_ui/InGameUI.tscn" id="5_lxtnp"]
|
[ext_resource type="PackedScene" uid="uid://b1muxus5qdbeu" path="res://src/ui/in_game_ui/InGameUI.tscn" id="5_lxtnp"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b16ejcwanod72" path="res://src/audio/InGameAudio.tscn" id="6_qc71l"]
|
[ext_resource type="PackedScene" uid="uid://b16ejcwanod72" path="res://src/audio/InGameAudio.tscn" id="6_qc71l"]
|
||||||
[ext_resource type="Script" uid="uid://daphxl6vvsbjm" path="res://src/game/DialogueController.cs" id="10_58pbt"]
|
[ext_resource type="Script" uid="uid://daphxl6vvsbjm" path="res://src/game/DialogueController.cs" id="10_58pbt"]
|
||||||
@@ -48,7 +49,8 @@ process_mode = 1
|
|||||||
[node name="Player" parent="SubViewportContainer/SubViewport/PauseContainer" instance=ExtResource("3_kk6ly")]
|
[node name="Player" parent="SubViewportContainer/SubViewport/PauseContainer" instance=ExtResource("3_kk6ly")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
transform = Transform3D(0.0141716, 0, 0.9999, 0, 1, 0, -0.9999, 0, 0.0141716, 0, -1.02535, -6.18796)
|
transform = Transform3D(0.0141716, 0, 0.9999, 0, 1, 0, -0.9999, 0, 0.0141716, 0, -2.25339, -6.18796)
|
||||||
|
_defaultWeapon = ExtResource("4_6pp6l")
|
||||||
|
|
||||||
[node name="Map" parent="SubViewportContainer/SubViewport/PauseContainer" instance=ExtResource("3_d8awv")]
|
[node name="Map" parent="SubViewportContainer/SubViewport/PauseContainer" instance=ExtResource("3_d8awv")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|||||||
@@ -26,4 +26,6 @@ public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvid
|
|||||||
public void AnnounceMessageOnMainScreen(string message);
|
public void AnnounceMessageOnMainScreen(string message);
|
||||||
|
|
||||||
public void FloorExitReached();
|
public void FloorExitReached();
|
||||||
|
|
||||||
|
public void NextFloorLoaded();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,7 @@ namespace GameJamDungeon;
|
|||||||
|
|
||||||
public interface IMap : INode3D
|
public interface IMap : INode3D
|
||||||
{
|
{
|
||||||
event Map.DungeonFinishedGeneratingEventHandler DungeonFinishedGenerating;
|
public Godot.Collections.Array<PackedScene> Floors { get; }
|
||||||
|
|
||||||
public List<IDungeonFloor> Floors { get; }
|
|
||||||
|
|
||||||
public void SpawnNextFloor();
|
public void SpawnNextFloor();
|
||||||
|
|
||||||
@@ -24,33 +22,37 @@ public partial class Map : Node3D, IMap
|
|||||||
{
|
{
|
||||||
public override void _Notification(int what) => this.Notify(what);
|
public override void _Notification(int what) => this.Notify(what);
|
||||||
|
|
||||||
[Signal]
|
|
||||||
public delegate void DungeonFinishedGeneratingEventHandler();
|
|
||||||
|
|
||||||
[Dependency]
|
[Dependency]
|
||||||
public IGameEventDepot GameEventDepot => this.DependOn<IGameEventDepot>();
|
public IGame Game => this.DependOn<IGame>();
|
||||||
|
|
||||||
public List<IDungeonFloor> Floors { get; set; } = default!;
|
[Export]
|
||||||
|
public Godot.Collections.Array<PackedScene> Floors { get; set; } = default!;
|
||||||
[Node] public Floor0 Floor0 { get; set; } = default!;
|
|
||||||
|
|
||||||
private IDungeonFloor _currentFloor;
|
private IDungeonFloor _currentFloor;
|
||||||
|
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
Floors = GetChildren().OfType<IDungeonFloor>().ToList();
|
LoadFloor();
|
||||||
_currentFloor = Floors.ElementAt(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SpawnNextFloor()
|
public void SpawnNextFloor()
|
||||||
{
|
{
|
||||||
var oldFloor = _currentFloor;
|
var oldFloor = _currentFloor;
|
||||||
Floors.Remove(oldFloor);
|
|
||||||
oldFloor.CallDeferred(MethodName.QueueFree, []);
|
oldFloor.CallDeferred(MethodName.QueueFree, []);
|
||||||
_currentFloor = Floors.ElementAt(0);
|
LoadFloor();
|
||||||
_currentFloor.InitializeDungeon();
|
_currentFloor.InitializeDungeon();
|
||||||
EmitSignal(SignalName.DungeonFinishedGenerating);
|
Game.NextFloorLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Transform3D GetPlayerSpawnPosition() => _currentFloor.GetPlayerSpawnPoint();
|
public Transform3D GetPlayerSpawnPosition() => _currentFloor.GetPlayerSpawnPoint();
|
||||||
|
|
||||||
|
private void LoadFloor()
|
||||||
|
{
|
||||||
|
var currentFloorScene = Floors.First();
|
||||||
|
var instantiator = new Instantiator(GetTree());
|
||||||
|
var loadedScene = instantiator.LoadAndInstantiate<Node3D>(currentFloorScene.ResourcePath);
|
||||||
|
AddChild(loadedScene);
|
||||||
|
_currentFloor = (IDungeonFloor)loadedScene;
|
||||||
|
Floors.Remove(currentFloorScene);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,75 +1,13 @@
|
|||||||
[gd_scene load_steps=22 format=3 uid="uid://by67pn7fdsg1m"]
|
[gd_scene load_steps=6 format=3 uid="uid://by67pn7fdsg1m"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://14e8mu48ed4" path="res://src/map/Map.cs" id="1_bw70o"]
|
[ext_resource type="Script" uid="uid://14e8mu48ed4" path="res://src/map/Map.cs" id="1_bw70o"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dl6h1djc27ddl" path="res://src/map/dungeon/floors/Floor00.tscn" id="2_0m8h8"]
|
[ext_resource type="PackedScene" uid="uid://dl6h1djc27ddl" path="res://src/map/dungeon/floors/Floor00.tscn" id="2_0m8h8"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bc1sp6xwe0j65" path="res://src/map/dungeon/floors/Floor01.tscn" id="2_merfv"]
|
[ext_resource type="PackedScene" uid="uid://bc1sp6xwe0j65" path="res://src/map/dungeon/floors/Floor01.tscn" id="2_merfv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dmiqwmivkjgmq" path="res://src/map/dungeon/floors/Floor02.tscn" id="4_8y0oy"]
|
[ext_resource type="PackedScene" uid="uid://dmiqwmivkjgmq" path="res://src/map/dungeon/floors/Floor02.tscn" id="4_8y0oy"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bjqgl5u05ia04" path="res://src/map/dungeon/Teleport.tscn" id="5_jiohg"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dl1scvkp8r5sw" path="res://src/map/dungeon/floors/Floor03.tscn" id="5_uag72"]
|
[ext_resource type="PackedScene" uid="uid://dl1scvkp8r5sw" path="res://src/map/dungeon/floors/Floor03.tscn" id="5_uag72"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cikq7vuorlpbl" path="res://src/map/dungeon/floors/Floor04.tscn" id="6_httk4"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://t7cac7801bnk" path="res://src/map/dungeon/floors/Floor05.tscn" id="7_ro62w"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://da107mywg18x1" path="res://src/map/dungeon/floors/Floor06.tscn" id="8_q7oan"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://cgtqjgh1f5fqi" path="res://src/map/dungeon/floors/Floor07.tscn" id="9_3vg2e"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dg20ovvj2m2lp" path="res://src/map/dungeon/floors/Floor08.tscn" id="10_tx34j"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://b5jk743ng6fqg" path="res://src/map/dungeon/floors/Floor09.tscn" id="11_8npfy"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dl2x3l7a3an65" path="res://src/map/dungeon/floors/Floor11.tscn" id="12_pids3"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://drvjw06wbi2qh" path="res://src/map/dungeon/floors/Floor12.tscn" id="13_u3fsa"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://fellg2owwe64" path="res://src/map/dungeon/floors/Floor13.tscn" id="14_io2ww"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://vhqwff12y7wn" path="res://src/map/dungeon/floors/Floor14.tscn" id="15_rb6u5"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://h8tc1uohuqx2" path="res://src/map/dungeon/floors/Floor15.tscn" id="16_31a0u"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://cyfp0p38w2yfr" path="res://src/map/dungeon/floors/Floor16.tscn" id="17_sbsee"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dnrbqkv438tjx" path="res://src/map/dungeon/floors/Floor17.tscn" id="18_qamtw"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://cgoogenmugoti" path="res://src/map/dungeon/floors/Floor18.tscn" id="19_j54h1"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://33lvido1dkbu" path="res://src/map/dungeon/floors/Floor19.tscn" id="20_41t83"]
|
|
||||||
|
|
||||||
[node name="Map" type="Node3D"]
|
[node name="Map" type="Node3D"]
|
||||||
script = ExtResource("1_bw70o")
|
script = ExtResource("1_bw70o")
|
||||||
|
Floors = Array[PackedScene]([ExtResource("2_0m8h8"), ExtResource("2_merfv"), ExtResource("4_8y0oy"), ExtResource("5_uag72")])
|
||||||
|
|
||||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||||
|
|
||||||
[node name="Floor0" parent="." instance=ExtResource("2_0m8h8")]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.77792, 1.78656, -5.13176)
|
|
||||||
|
|
||||||
[node name="Floor1" parent="." instance=ExtResource("2_merfv")]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
|
|
||||||
[node name="Floor2" parent="." instance=ExtResource("4_8y0oy")]
|
|
||||||
|
|
||||||
[node name="Floor3" parent="." instance=ExtResource("5_uag72")]
|
|
||||||
|
|
||||||
[node name="Floor04" parent="." instance=ExtResource("6_httk4")]
|
|
||||||
|
|
||||||
[node name="Floor05" parent="." instance=ExtResource("7_ro62w")]
|
|
||||||
|
|
||||||
[node name="Floor06" parent="." instance=ExtResource("8_q7oan")]
|
|
||||||
|
|
||||||
[node name="Floor07" parent="." instance=ExtResource("9_3vg2e")]
|
|
||||||
|
|
||||||
[node name="Floor08" parent="." instance=ExtResource("10_tx34j")]
|
|
||||||
|
|
||||||
[node name="Floor09" parent="." instance=ExtResource("11_8npfy")]
|
|
||||||
|
|
||||||
[node name="Floor11" parent="." instance=ExtResource("12_pids3")]
|
|
||||||
|
|
||||||
[node name="Floor12" parent="." instance=ExtResource("13_u3fsa")]
|
|
||||||
|
|
||||||
[node name="Floor13" parent="." instance=ExtResource("14_io2ww")]
|
|
||||||
|
|
||||||
[node name="Floor14" parent="." instance=ExtResource("15_rb6u5")]
|
|
||||||
|
|
||||||
[node name="Floor15" parent="." instance=ExtResource("16_31a0u")]
|
|
||||||
|
|
||||||
[node name="Floor16" parent="." instance=ExtResource("17_sbsee")]
|
|
||||||
|
|
||||||
[node name="Floor17" parent="." instance=ExtResource("18_qamtw")]
|
|
||||||
|
|
||||||
[node name="Floor18" parent="." instance=ExtResource("19_j54h1")]
|
|
||||||
|
|
||||||
[node name="Floor19" parent="." instance=ExtResource("20_41t83")]
|
|
||||||
|
|
||||||
[node name="Teleport" parent="." instance=ExtResource("5_jiohg")]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
process_mode = 3
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 900, 900, 900)
|
|
||||||
disable_mode = 2
|
|
||||||
|
|||||||
8
src/map/dungeon/NavigationMesh.tres
Normal file
8
src/map/dungeon/NavigationMesh.tres
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[gd_resource type="NavigationMesh" format=3 uid="uid://d3n1gyxfjcm5u"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
vertices = PackedVector3Array(-39, -1.46346, -18.25, -29.25, -1.46346, -18, -29, -1.46346, -20.25, -28.25, -1.46346, -21, -26.25, -1.46346, -39, -39, -1.46346, -39, -26.25, -1.46346, -21, -13.5, -1.46346, -21, -13.5, -1.46346, -39, -11.5, -1.46346, -21, -10.75, -1.46346, -20.25, 39, -1.46346, -39, -10.75, -1.46346, -1, 39, -1.46346, -0.75, -25.25, -1.46346, -15.75, -26.5, -1.46346, -15, -26.5, -1.46346, -13, -21, -1.46346, -12, -18, -1.46346, -11.25, -18, -1.46346, -10, -13.25, -1.46346, -10, -13.25, -1.46346, -15, -14, -1.46346, -15, -14.75, -1.46346, -15.75, -18.75, -1.46346, -12, -14.5, -1.46346, -18.5, -25.25, -1.46346, -18.5, -39, -1.46346, -13.75, -29, -1.46346, -13.75, -29, -1.46346, -8.25, -28, -1.46346, -9, -28, -1.46346, -11, -29, -1.46346, -11.75, -39, -1.46346, -6.25, -29, -1.46346, -6.25, -27, -1.46346, -8.5, -26.75, -1.46346, -11.75, -26.5, -1.46346, -6.75, -21, -1.46346, -8, -22, -1.46346, -8.75, -22, -1.46346, -11.25, -26.5, -1.46346, -4.75, -25.25, -1.46346, -4, -18, -1.46346, -8.75, -14, -1.46346, -4.75, -13.25, -1.46346, -4.75, -18.75, -1.46346, -8, -14.75, -1.46346, -4, -25.5, -1.46346, -1.25, -14.5, -1.46346, -1.25, -29.25, -1.46346, -1.75, -39, -1.46346, -1.5, -29, -1.46346, 0.5, -28.25, -1.46346, 1.25, -39, -1.46346, 39, -12.75, -1.46346, 39, -13, -1.46346, 1.25, -11.5, -1.46346, 1.25, -10.75, -1.46346, 0.5, 39, -1.46346, 39)
|
||||||
|
polygons = [PackedInt32Array(2, 1, 0), PackedInt32Array(2, 0, 3), PackedInt32Array(3, 0, 5), PackedInt32Array(3, 5, 4), PackedInt32Array(4, 6, 3), PackedInt32Array(4, 8, 6), PackedInt32Array(6, 8, 7), PackedInt32Array(9, 7, 8), PackedInt32Array(9, 8, 10), PackedInt32Array(10, 8, 11), PackedInt32Array(12, 10, 13), PackedInt32Array(13, 10, 11), PackedInt32Array(15, 14, 16), PackedInt32Array(16, 14, 17), PackedInt32Array(20, 19, 18), PackedInt32Array(22, 21, 20), PackedInt32Array(18, 24, 20), PackedInt32Array(20, 24, 22), PackedInt32Array(22, 24, 23), PackedInt32Array(24, 17, 23), PackedInt32Array(23, 17, 25), PackedInt32Array(25, 17, 14), PackedInt32Array(25, 14, 26), PackedInt32Array(0, 1, 27), PackedInt32Array(27, 1, 28), PackedInt32Array(30, 29, 31), PackedInt32Array(31, 29, 32), PackedInt32Array(32, 29, 33), PackedInt32Array(32, 33, 27), PackedInt32Array(27, 28, 32), PackedInt32Array(29, 34, 33), PackedInt32Array(30, 31, 35), PackedInt32Array(35, 31, 36), PackedInt32Array(39, 38, 37), PackedInt32Array(36, 16, 35), PackedInt32Array(35, 16, 37), PackedInt32Array(37, 16, 39), PackedInt32Array(39, 16, 40), PackedInt32Array(16, 17, 40), PackedInt32Array(41, 37, 42), PackedInt32Array(42, 37, 38), PackedInt32Array(43, 19, 20), PackedInt32Array(20, 45, 44), PackedInt32Array(43, 20, 46), PackedInt32Array(46, 20, 44), PackedInt32Array(46, 44, 47), PackedInt32Array(46, 47, 38), PackedInt32Array(38, 47, 49), PackedInt32Array(38, 49, 42), PackedInt32Array(42, 49, 48), PackedInt32Array(51, 33, 50), PackedInt32Array(50, 33, 34), PackedInt32Array(52, 51, 50), PackedInt32Array(52, 53, 51), PackedInt32Array(51, 53, 54), PackedInt32Array(56, 55, 53), PackedInt32Array(53, 55, 54), PackedInt32Array(55, 56, 57), PackedInt32Array(57, 58, 55), PackedInt32Array(55, 58, 59), PackedInt32Array(59, 58, 13), PackedInt32Array(58, 12, 13)]
|
||||||
|
geometry_parsed_geometry_type = 1
|
||||||
|
geometry_collision_mask = 2147483648
|
||||||
|
agent_radius = 1.0
|
||||||
@@ -19,6 +19,4 @@ public partial class BossFloor : Node3D, IDungeonFloor
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Transform3D GetPlayerSpawnPoint() => BossRoom.PlayerSpawn.GlobalTransform;
|
public Transform3D GetPlayerSpawnPoint() => BossRoom.PlayerSpawn.GlobalTransform;
|
||||||
|
|
||||||
public Vector3 GetTeleportSpawnPoint() => BossRoom.TeleportSpawn.GlobalPosition;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ public partial class BossRoomA : Node3D, IBossRoom
|
|||||||
|
|
||||||
[Node] public Marker3D PlayerSpawn { get; set; } = default!;
|
[Node] public Marker3D PlayerSpawn { get; set; } = default!;
|
||||||
|
|
||||||
[Node] public Marker3D TeleportSpawn { get; set; } = default!;
|
|
||||||
|
|
||||||
[Node] public Node3D HorseHeadStatue { get; set; } = default!;
|
[Node] public Node3D HorseHeadStatue { get; set; } = default!;
|
||||||
|
|
||||||
[Node] public Node3D OxFaceStatue { get; set; } = default!;
|
[Node] public Node3D OxFaceStatue { get; set; } = default!;
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ namespace GameJamDungeon
|
|||||||
|
|
||||||
[Node] public GodotObject DungeonGenerator { get; set; } = default!;
|
[Node] public GodotObject DungeonGenerator { get; set; } = default!;
|
||||||
|
|
||||||
[Node] public NavigationRegion3D NavigationRegion3D { get; set; } = default!;
|
|
||||||
|
|
||||||
[Node] public EnemyDatabase EnemyDatabase { get; set; } = default!;
|
[Node] public EnemyDatabase EnemyDatabase { get; set; } = default!;
|
||||||
|
|
||||||
private Transform3D _playerSpawnPoint;
|
private Transform3D _playerSpawnPoint;
|
||||||
@@ -23,13 +21,12 @@ namespace GameJamDungeon
|
|||||||
|
|
||||||
public void InitializeDungeon()
|
public void InitializeDungeon()
|
||||||
{
|
{
|
||||||
Rooms = new List<MonsterRoom>();
|
Rooms = [];
|
||||||
DungeonGenerator.Call("generate");
|
|
||||||
NavigationRegion3D.BakeNavigationMesh();
|
|
||||||
Rooms = FindAllDungeonRooms([.. GetChildren()], Rooms);
|
Rooms = FindAllDungeonRooms([.. GetChildren()], Rooms);
|
||||||
_playerSpawnPoint = RandomizePlayerSpawnPoint();
|
_playerSpawnPoint = RandomizePlayerSpawnPoint();
|
||||||
foreach (var room in Rooms)
|
foreach (var room in Rooms)
|
||||||
room.SpawnEnemies(EnemyDatabase);
|
room.SpawnEnemies(EnemyDatabase);
|
||||||
|
DungeonGenerator.EmitSignal("done_generating");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Transform3D GetPlayerSpawnPoint() => _playerSpawnPoint;
|
public Transform3D GetPlayerSpawnPoint() => _playerSpawnPoint;
|
||||||
@@ -52,9 +49,14 @@ namespace GameJamDungeon
|
|||||||
return roomsFound;
|
return roomsFound;
|
||||||
|
|
||||||
foreach (var node in nodesToSearch)
|
foreach (var node in nodesToSearch)
|
||||||
|
{
|
||||||
if (node is MonsterRoom dungeonRoom)
|
if (node is MonsterRoom dungeonRoom)
|
||||||
roomsFound.Add(dungeonRoom);
|
roomsFound.Add(dungeonRoom);
|
||||||
|
|
||||||
|
if (node.HasSignal("dungeon_done_generating"))
|
||||||
|
node.EmitSignal("dungeon_done_generating");
|
||||||
|
}
|
||||||
|
|
||||||
return FindAllDungeonRooms(nodesToSearch.SelectMany(x => x.GetChildren()).ToList(), roomsFound);
|
return FindAllDungeonRooms(nodesToSearch.SelectMany(x => x.GetChildren()).ToList(), roomsFound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=58 format=4 uid="uid://dpec2lbt83dhe"]
|
[gd_scene load_steps=59 format=4 uid="uid://dpec2lbt83dhe"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://ce73fuh74l81l" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_ho6e8"]
|
[ext_resource type="Script" uid="uid://ce73fuh74l81l" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_ho6e8"]
|
||||||
[ext_resource type="Script" uid="uid://dhollu4j3pynq" path="res://src/map/dungeon/code/MonsterRoom.cs" id="2_phhs1"]
|
[ext_resource type="Script" uid="uid://dhollu4j3pynq" path="res://src/map/dungeon/code/MonsterRoom.cs" id="2_phhs1"]
|
||||||
@@ -645,6 +645,9 @@ _surfaces = [{
|
|||||||
blend_shape_mode = 0
|
blend_shape_mode = 0
|
||||||
shadow_mesh = SubResource("ArrayMesh_i3ffh")
|
shadow_mesh = SubResource("ArrayMesh_i3ffh")
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_phhs1"]
|
||||||
|
size = Vector3(2.12268, 5.82227, 1.63702)
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_51rrf"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_51rrf"]
|
||||||
shading_mode = 0
|
shading_mode = 0
|
||||||
albedo_texture = ExtResource("20_le1vp")
|
albedo_texture = ExtResource("20_le1vp")
|
||||||
@@ -679,6 +682,8 @@ script = ExtResource("2_phhs1")
|
|||||||
|
|
||||||
[node name="StaticBody3D" type="StaticBody3D" parent="Antechamber A"]
|
[node name="StaticBody3D" type="StaticBody3D" parent="Antechamber A"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.10505, -1.44377, 0.0953512)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.10505, -1.44377, 0.0953512)
|
||||||
|
collision_layer = 2147483649
|
||||||
|
collision_mask = 2147483649
|
||||||
|
|
||||||
[node name="ROOM" type="MeshInstance3D" parent="Antechamber A/StaticBody3D"]
|
[node name="ROOM" type="MeshInstance3D" parent="Antechamber A/StaticBody3D"]
|
||||||
transform = Transform3D(0.287429, 0, 0, 0, 0.287429, 0, 0, 0, 0.287429, 2.1526, 3.44987, -0.0743999)
|
transform = Transform3D(0.287429, 0, 0, 0, 0.287429, 0, 0, 0, 0.287429, 2.1526, 3.44987, -0.0743999)
|
||||||
@@ -759,6 +764,19 @@ unique_name_in_owner = true
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.33663, -1.49877, 0.845012)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.33663, -1.49877, 0.845012)
|
||||||
|
|
||||||
|
[node name="StaticBody3D2" type="StaticBody3D" parent="Antechamber A"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -87.0242)
|
||||||
|
collision_layer = 2147483648
|
||||||
|
collision_mask = 2147483648
|
||||||
|
|
||||||
|
[node name="CollisionShape3D7" type="CollisionShape3D" parent="Antechamber A/StaticBody3D2"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.49594, -0.677457, 94.6461)
|
||||||
|
shape = SubResource("BoxShape3D_phhs1")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D8" type="CollisionShape3D" parent="Antechamber A/StaticBody3D2"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.66204, -0.677457, 94.7863)
|
||||||
|
shape = SubResource("BoxShape3D_phhs1")
|
||||||
|
|
||||||
[node name="CSGBox3D" type="CSGBox3D" parent="."]
|
[node name="CSGBox3D" type="CSGBox3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0314088, 4.23029, -0.0385468)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0314088, 4.23029, -0.0385468)
|
||||||
visible = false
|
visible = false
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=65 format=4 uid="uid://b82dx66mgs2d7"]
|
[gd_scene load_steps=66 format=4 uid="uid://b82dx66mgs2d7"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://ce73fuh74l81l" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_0qew1"]
|
[ext_resource type="Script" uid="uid://ce73fuh74l81l" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_0qew1"]
|
||||||
[ext_resource type="Script" uid="uid://dhollu4j3pynq" path="res://src/map/dungeon/code/MonsterRoom.cs" id="2_pu81k"]
|
[ext_resource type="Script" uid="uid://dhollu4j3pynq" path="res://src/map/dungeon/code/MonsterRoom.cs" id="2_pu81k"]
|
||||||
@@ -700,6 +700,9 @@ _surfaces = [{
|
|||||||
blend_shape_mode = 0
|
blend_shape_mode = 0
|
||||||
shadow_mesh = SubResource("ArrayMesh_jks6o")
|
shadow_mesh = SubResource("ArrayMesh_jks6o")
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_pu81k"]
|
||||||
|
size = Vector3(2.12268, 5.82227, 1.63702)
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_bnx07"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_bnx07"]
|
||||||
albedo_texture = ExtResource("3_xx585")
|
albedo_texture = ExtResource("3_xx585")
|
||||||
texture_filter = 0
|
texture_filter = 0
|
||||||
@@ -752,6 +755,8 @@ mesh = SubResource("ArrayMesh_sx1ls")
|
|||||||
skeleton = NodePath("")
|
skeleton = NodePath("")
|
||||||
|
|
||||||
[node name="StaticBody3D" type="StaticBody3D" parent="BasinRoom/BASIN_ROOM_VER2"]
|
[node name="StaticBody3D" type="StaticBody3D" parent="BasinRoom/BASIN_ROOM_VER2"]
|
||||||
|
collision_layer = 2147483649
|
||||||
|
collision_mask = 2147483649
|
||||||
|
|
||||||
[node name="ROOM_001" type="MeshInstance3D" parent="BasinRoom/BASIN_ROOM_VER2/StaticBody3D"]
|
[node name="ROOM_001" type="MeshInstance3D" parent="BasinRoom/BASIN_ROOM_VER2/StaticBody3D"]
|
||||||
transform = Transform3D(0.35918, 0, 0, 0, 0.287429, 0, 0, 0, 0.287429, -3.6523, 13.6997, 102.523)
|
transform = Transform3D(0.35918, 0, 0, 0, 0.287429, 0, 0, 0, 0.287429, -3.6523, 13.6997, 102.523)
|
||||||
@@ -829,9 +834,17 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.55, -2.55692, 0)
|
|||||||
[node name="ItemDatabase" parent="BasinRoom/BASIN_ROOM_VER2" instance=ExtResource("18_bwap2")]
|
[node name="ItemDatabase" parent="BasinRoom/BASIN_ROOM_VER2" instance=ExtResource("18_bwap2")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
||||||
[node name="TeleportSpawn" type="Marker3D" parent="BasinRoom/BASIN_ROOM_VER2"]
|
[node name="StaticBody3D2" type="StaticBody3D" parent="BasinRoom/BASIN_ROOM_VER2"]
|
||||||
unique_name_in_owner = true
|
collision_layer = 2147483648
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.28791, 10.2563, 106.274)
|
collision_mask = 2147483648
|
||||||
|
|
||||||
|
[node name="CollisionShape3D7" type="CollisionShape3D" parent="BasinRoom/BASIN_ROOM_VER2/StaticBody3D2"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.86587, 12.1211, 94.6461)
|
||||||
|
shape = SubResource("BoxShape3D_pu81k")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D8" type="CollisionShape3D" parent="BasinRoom/BASIN_ROOM_VER2/StaticBody3D2"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.03197, 12.1211, 94.7863)
|
||||||
|
shape = SubResource("BoxShape3D_pu81k")
|
||||||
|
|
||||||
[node name="CSGBox3D" type="CSGBox3D" parent="BasinRoom"]
|
[node name="CSGBox3D" type="CSGBox3D" parent="BasinRoom"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0382157, 4.21368, -0.0118849)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0382157, 4.21368, -0.0118849)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=37 format=4 uid="uid://bn4gslp2gk8ds"]
|
[gd_scene load_steps=38 format=4 uid="uid://bn4gslp2gk8ds"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://fk3jis6rsipv" path="res://src/map/dungeon/code/corridor.gd" id="1_lepkf"]
|
[ext_resource type="Script" uid="uid://fk3jis6rsipv" path="res://src/map/dungeon/code/corridor.gd" id="1_lepkf"]
|
||||||
[ext_resource type="Texture2D" uid="uid://crsw35eypj6ry" path="res://src/map/dungeon/models/Set A/18. Corridor A/18_A1_CORRIDOR_A_WALL TILE 1.jpg" id="2_jmyyj"]
|
[ext_resource type="Texture2D" uid="uid://crsw35eypj6ry" path="res://src/map/dungeon/models/Set A/18. Corridor A/18_A1_CORRIDOR_A_WALL TILE 1.jpg" id="2_jmyyj"]
|
||||||
@@ -496,6 +496,9 @@ _surfaces = [{
|
|||||||
blend_shape_mode = 0
|
blend_shape_mode = 0
|
||||||
shadow_mesh = SubResource("ArrayMesh_p4f4g")
|
shadow_mesh = SubResource("ArrayMesh_p4f4g")
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_gbjb2"]
|
||||||
|
size = Vector3(4.40063, 4, 1.67725)
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lepkf"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lepkf"]
|
||||||
transparency = 1
|
transparency = 1
|
||||||
albedo_color = Color(1, 1, 1, 0)
|
albedo_color = Color(1, 1, 1, 0)
|
||||||
@@ -732,6 +735,14 @@ transform = Transform3D(-2, 0, 1.74846e-07, 0, 0.10779, 0, -1.74846e-07, 0, -2,
|
|||||||
mesh = SubResource("ArrayMesh_ux4sw")
|
mesh = SubResource("ArrayMesh_ux4sw")
|
||||||
skeleton = NodePath("")
|
skeleton = NodePath("")
|
||||||
|
|
||||||
|
[node name="StaticBody3D" type="StaticBody3D" parent="DOOR?_F_CUT"]
|
||||||
|
collision_layer = 2147483648
|
||||||
|
collision_mask = 2147483648
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="DOOR?_F_CUT/StaticBody3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0286865, 0, 0.463623)
|
||||||
|
shape = SubResource("BoxShape3D_gbjb2")
|
||||||
|
|
||||||
[node name="DOOR?_R_CUT" type="CSGBox3D" parent="."]
|
[node name="DOOR?_R_CUT" type="CSGBox3D" parent="."]
|
||||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -1.87415, -0.109414, -0.094615)
|
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -1.87415, -0.109414, -0.094615)
|
||||||
use_collision = true
|
use_collision = true
|
||||||
@@ -743,6 +754,13 @@ transform = Transform3D(-8.74228e-08, 0, -2, 0, 0.10779, 0, 2, 0, -8.74228e-08,
|
|||||||
mesh = SubResource("ArrayMesh_tmqha")
|
mesh = SubResource("ArrayMesh_tmqha")
|
||||||
skeleton = NodePath("")
|
skeleton = NodePath("")
|
||||||
|
|
||||||
|
[node name="StaticBody3D" type="StaticBody3D" parent="DOOR?_R_CUT"]
|
||||||
|
collision_layer = 2147483648
|
||||||
|
collision_mask = 2147483648
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="DOOR?_R_CUT/StaticBody3D"]
|
||||||
|
shape = SubResource("BoxShape3D_gbjb2")
|
||||||
|
|
||||||
[node name="DOOR?_L_CUT" type="CSGBox3D" parent="."]
|
[node name="DOOR?_L_CUT" type="CSGBox3D" parent="."]
|
||||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 1.98471, -0.0715388, -0.0946158)
|
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 1.98471, -0.0715388, -0.0946158)
|
||||||
use_collision = true
|
use_collision = true
|
||||||
@@ -754,6 +772,13 @@ transform = Transform3D(-8.74228e-08, 0, -2, 0, 0.10779, 0, 2, 0, -8.74228e-08,
|
|||||||
mesh = SubResource("ArrayMesh_o04ue")
|
mesh = SubResource("ArrayMesh_o04ue")
|
||||||
skeleton = NodePath("")
|
skeleton = NodePath("")
|
||||||
|
|
||||||
|
[node name="StaticBody3D" type="StaticBody3D" parent="DOOR?_L_CUT"]
|
||||||
|
collision_layer = 2147483648
|
||||||
|
collision_mask = 2147483648
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="DOOR?_L_CUT/StaticBody3D"]
|
||||||
|
shape = SubResource("BoxShape3D_gbjb2")
|
||||||
|
|
||||||
[node name="DOOR?_B_CUT" type="CSGBox3D" parent="."]
|
[node name="DOOR?_B_CUT" type="CSGBox3D" parent="."]
|
||||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -0.0339377, -0.127415, -2.00389)
|
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -0.0339377, -0.127415, -2.00389)
|
||||||
use_collision = true
|
use_collision = true
|
||||||
@@ -764,3 +789,10 @@ material = SubResource("StandardMaterial3D_4xu2u")
|
|||||||
transform = Transform3D(-2, 0, 1.74846e-07, 0, 0.10779, 0, -1.74846e-07, 0, -2, 0.00432197, 2.0282, -1.92743)
|
transform = Transform3D(-2, 0, 1.74846e-07, 0, 0.10779, 0, -1.74846e-07, 0, -2, 0.00432197, 2.0282, -1.92743)
|
||||||
mesh = SubResource("ArrayMesh_ue4n7")
|
mesh = SubResource("ArrayMesh_ue4n7")
|
||||||
skeleton = NodePath("")
|
skeleton = NodePath("")
|
||||||
|
|
||||||
|
[node name="StaticBody3D" type="StaticBody3D" parent="DOOR?_B_CUT"]
|
||||||
|
collision_layer = 2147483648
|
||||||
|
collision_mask = 2147483648
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="DOOR?_B_CUT/StaticBody3D"]
|
||||||
|
shape = SubResource("BoxShape3D_gbjb2")
|
||||||
|
|||||||
35
src/test/NavigationTestScene.tscn
Normal file
35
src/test/NavigationTestScene.tscn
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
[gd_scene load_steps=5 format=3 uid="uid://010r1fbkbooa"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cfecvvav8kkp6" path="res://src/player/Player.tscn" id="1_7xhku"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bksq62muhk3h5" path="res://src/enemy/enemy_types/1. sproingy/Sproingy.tscn" id="2_3keei"]
|
||||||
|
|
||||||
|
[sub_resource type="NavigationMesh" id="NavigationMesh_3keei"]
|
||||||
|
vertices = PackedVector3Array(-2.96237, 1.33137, -10.8745, -1.71237, 1.33137, -10.8745, -1.71237, 1.33137, -22.6245, -5.46237, 1.33137, -9.12453, -21.7124, 1.33137, -6.12453, -6.46237, 1.33137, -6.12453, -21.7124, 1.33137, -22.6245, 3.03763, 1.33137, -7.62453, 3.28763, 1.33137, -6.12453, 10.0376, 1.33137, -6.12453, 1.53763, 1.33137, -9.87453, -0.462372, 1.33137, -10.8745, 10.0376, 1.33137, -22.6245, -1.71237, 1.33137, 9.37547, -1.71237, 1.33137, -1.37453, -2.71237, 1.33137, -1.37453, -5.46237, 1.33137, -3.12453, -21.7124, 1.33137, 9.37547, 1.53763, 1.33137, -2.37453, -0.462372, 1.33137, -1.37453, 10.0376, 1.33137, 9.37547)
|
||||||
|
polygons = [PackedInt32Array(2, 1, 0), PackedInt32Array(2, 0, 3), PackedInt32Array(3, 5, 2), PackedInt32Array(2, 5, 4), PackedInt32Array(2, 4, 6), PackedInt32Array(9, 8, 7), PackedInt32Array(9, 7, 10), PackedInt32Array(10, 11, 9), PackedInt32Array(9, 11, 2), PackedInt32Array(9, 2, 12), PackedInt32Array(11, 1, 2), PackedInt32Array(15, 14, 13), PackedInt32Array(16, 15, 13), PackedInt32Array(16, 13, 5), PackedInt32Array(5, 13, 4), PackedInt32Array(4, 13, 17), PackedInt32Array(18, 8, 9), PackedInt32Array(13, 14, 19), PackedInt32Array(18, 9, 19), PackedInt32Array(19, 9, 13), PackedInt32Array(13, 9, 20)]
|
||||||
|
cell_height = 0.5
|
||||||
|
agent_radius = 3.0
|
||||||
|
|
||||||
|
[sub_resource type="CylinderShape3D" id="CylinderShape3D_3keei"]
|
||||||
|
height = 4.74658
|
||||||
|
radius = 1.71777
|
||||||
|
|
||||||
|
[node name="Node3D" type="Node3D"]
|
||||||
|
|
||||||
|
[node name="Player" parent="." instance=ExtResource("1_7xhku")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.791832, 0)
|
||||||
|
|
||||||
|
[node name="Sproingy" parent="." instance=ExtResource("2_3keei")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.64783, -11.9575)
|
||||||
|
|
||||||
|
[node name="NavigationRegion3D" type="NavigationRegion3D" parent="."]
|
||||||
|
navigation_mesh = SubResource("NavigationMesh_3keei")
|
||||||
|
|
||||||
|
[node name="CSGBox3D" type="CSGBox3D" parent="NavigationRegion3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.79317, 0, -6.66189)
|
||||||
|
size = Vector3(37.8384, 1, 37.9253)
|
||||||
|
|
||||||
|
[node name="StaticBody3D" type="StaticBody3D" parent="NavigationRegion3D"]
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="NavigationRegion3D/StaticBody3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.61432, 1.20466, -6.13947)
|
||||||
|
shape = SubResource("CylinderShape3D_3keei")
|
||||||
Reference in New Issue
Block a user