Things are mostly fixed, but dialogue isn't disappearing

This commit is contained in:
2024-09-07 16:34:31 -07:00
parent b470a9d2fe
commit 872f246a23
9 changed files with 92 additions and 75 deletions

View File

@@ -42,6 +42,18 @@ Exit=""
[input]
ui_accept={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
]
}
ui_cancel={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194305,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
MoveUp={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
@@ -108,6 +120,7 @@ locale/translations_pot_files=PackedStringArray("res://src/dialog/TestDialogue.d
3d_physics/layer_5="Weapon"
3d_physics/layer_6="Alert"
3d_physics/layer_7="PlayerHitbox"
3d_physics/layer_8="Dialogue"
[navigation]

View File

@@ -1,23 +1,42 @@
using Godot;
using DialogueManagerRuntime;
using GameJamDungeon;
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
[Meta(typeof(IAutoNode))]
public partial class DialogueTest : Area3D
{
public override void _Notification(int what) => this.Notify(what);
[Export]
public Resource DialogueResource;
[Export]
public string DialougeStart = "start";
public string DialogueStart = "start";
public override void _Process(double delta)
[Dependency]
public IGameRepo GameRepo => this.DependOn<IGameRepo>();
public override void _Ready()
{
if (Input.IsActionJustPressed(GameInputs.Attack))
OnTalk();
AreaEntered += DialogueTest_AreaEntered;
AreaExited += DialogueTest_AreaExited;
}
public void OnTalk()
private void DialogueTest_AreaExited(Area3D area)
{
DialogueManager.ShowDialogueBalloon(DialogueResource, DialougeStart);
GameRepo.IsWithinDialogueSpace = false;
}
private void DialogueTest_AreaEntered(Area3D area)
{
GameRepo.IsWithinDialogueSpace = true;
}
public override void _UnhandledInput(InputEvent @event)
{
if (Input.IsActionJustPressed("ui_accept") && GameRepo.IsWithinDialogueSpace)
DialogueManager.ShowDialogueBalloon(DialogueResource, DialogueStart);
}
}

View File

@@ -8,6 +8,8 @@
size = Vector3(2, 2, 2)
[node name="Panel" type="Area3D"]
collision_layer = 0
collision_mask = 128
script = ExtResource("1_6offx")
DialogueResource = ExtResource("2_c26a0")
@@ -17,11 +19,10 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
text = "Test"
scroll_active = false
scroll_following = true
script = ExtResource("1_v3yy4")
skip_pause_at_abbreviations = PackedStringArray("eg", "ex")
skip_pause_at_abbreviations = PackedStringArray()
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.254547, -0.166077, -1.29401)

View File

@@ -30,8 +30,6 @@ public partial class Game : Node3D, IGame
[Node] public Control MiniMap { get; set; } = default!;
[Node] public NavigationRegion3D NavigationRegion { get; set; } = default!;
[Node] public Area3D Teleport { get; set; } = default!;
[Node] public IDungeonFloor Overworld { get; set; } = default!;
@@ -73,7 +71,6 @@ public partial class Game : Node3D, IGame
})
.Handle((in GameLogic.Output.LoadNextFloor _) =>
{
SetPauseMode(true);
AnimationPlayer.Play("wait_and_load");
var currentFloor = Floors.ElementAt(_currentFloor);
currentFloor.CallDeferred(MethodName.QueueFree, []);
@@ -101,8 +98,6 @@ public partial class Game : Node3D, IGame
private void AnimationPlayer_AnimationStarted(StringName animName)
{
SetPauseMode(true);
var newFloor = Floors.ElementAt(_currentFloor + 1);
newFloor.CallDeferred(nameof(newFloor.InitializeDungeon), []);
newFloor.Show();
@@ -113,7 +108,6 @@ public partial class Game : Node3D, IGame
var spawnPoints = GetTree().GetNodesInGroup("Exit").OfType<Marker3D>();
Teleport.GlobalPosition = spawnPoints.Last().GlobalPosition;
_currentFloor++;
SetPauseMode(false);
}
public override void _Process(double delta)

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=3 uid="uid://33ek675mfb5n"]
[gd_scene load_steps=16 format=3 uid="uid://33ek675mfb5n"]
[ext_resource type="Script" path="res://src/game/Game.cs" id="1_ytcii"]
[ext_resource type="PackedScene" uid="uid://cfecvvav8kkp6" path="res://src/player/Player.tscn" id="3_kk6ly"]
@@ -10,12 +10,9 @@
[ext_resource type="PackedScene" uid="uid://b40sstnic41dw" path="res://src/map/dungeon/floors/Floor3.tscn" id="8_87yk1"]
[ext_resource type="PackedScene" uid="uid://c3ek5i43cl0r5" path="res://src/map/Teleport.tscn" id="9_nwu7r"]
[ext_resource type="PackedScene" uid="uid://xb02opiwelet" path="res://src/dialog/DialogueTest.tscn" id="10_kejri"]
[ext_resource type="Resource" uid="uid://bw086h2dmhraf" path="res://src/dialog/TestDialogue.dialogue" id="11_4jbgd"]
[sub_resource type="Environment" id="Environment_fke5g"]
[sub_resource type="NavigationMesh" id="NavigationMesh_xligp"]
[sub_resource type="Animation" id="Animation_nc1gg"]
length = 0.001
tracks/0/type = "value"
@@ -73,14 +70,12 @@ _data = {
process_mode = 3
script = ExtResource("1_ytcii")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_fke5g")
[node name="Player" parent="." instance=ExtResource("3_kk6ly")]
process_mode = 1
transform = Transform3D(0.0871905, 0, -0.996192, 0, 1, 0, 0.996192, 0, 0.0871905, -11.0585, -2.7998, -6.0685)
MoveSpeed = 8.0
Acceleration = 4.0
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3.4456, 1.22144)
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_fke5g")
[node name="MiniMap" parent="." instance=ExtResource("6_owlf4")]
unique_name_in_owner = true
@@ -88,6 +83,7 @@ visible = false
[node name="InventoryMenu" parent="." instance=ExtResource("4_wk8gw")]
unique_name_in_owner = true
process_mode = 3
visible = false
[node name="OmniLight3D" type="OmniLight3D" parent="."]
@@ -96,25 +92,17 @@ layers = 3
omni_range = 163.618
omni_attenuation = -0.183
[node name="NavigationRegion" type="NavigationRegion3D" parent="."]
unique_name_in_owner = true
navigation_mesh = SubResource("NavigationMesh_xligp")
[node name="Overworld" parent="." instance=ExtResource("5_4hqe8")]
unique_name_in_owner = true
visible = false
[node name="Floor1" parent="." instance=ExtResource("6_75lk5")]
unique_name_in_owner = true
visible = false
[node name="Floor2" parent="." instance=ExtResource("7_1sm5s")]
unique_name_in_owner = true
visible = false
[node name="Floor3" parent="." instance=ExtResource("8_87yk1")]
unique_name_in_owner = true
visible = false
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
@@ -138,5 +126,4 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 900, 900, 900)
disable_mode = 2
[node name="Panel" parent="." instance=ExtResource("10_kejri")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.42724, 0, -7.22283)
DialogueResource = ExtResource("11_4jbgd")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.42724, 0.203153, -2.07301)

View File

@@ -38,6 +38,8 @@ public interface IGameRepo : IDisposable
public AutoProp<int> HPBarValue { get; }
public AutoProp<int> VTBarValue { get; }
bool IsWithinDialogueSpace { get; set; }
}
public class GameRepo : IGameRepo
@@ -72,6 +74,8 @@ public class GameRepo : IGameRepo
public AutoProp<int> VTBarValue { get; }
public bool IsWithinDialogueSpace { get; set; }
private bool _disposedValue;
public GameRepo()
@@ -83,6 +87,7 @@ public class GameRepo : IGameRepo
_equippedWeapon = new Weapon();
HPBarValue = new AutoProp<int>(0);
VTBarValue = new AutoProp<int>(0);
IsWithinDialogueSpace = false;
}
public void Pause()

View File

@@ -16,7 +16,7 @@ size = Vector3(20, 10, 20)
[node name="PlayerSpawnPoint" type="Marker3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4, -6)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.03633, -4.09327, 6.89279)
[node name="ExitSpawnPoint" type="Marker3D" parent="." groups=["Exit"]]
unique_name_in_owner = true
@@ -30,3 +30,4 @@ transform = Transform3D(1.4, 0, 0, 0, 1.4, 0, 0, 0, 1.4, -8.84798, -2.93175, -3.
[node name="Panel" parent="Goddess" instance=ExtResource("4_thkm7")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0604029, 0.440545, 0.961159)
collision_layer = 2

View File

@@ -166,7 +166,7 @@ namespace GameJamDungeon
PlayerLogic.Input(new PlayerLogic.Input.PhysicsTick(delta));
var attackIsPressed = Input.IsActionJustPressed(GameInputs.Attack);
if (attackIsPressed)
if (attackIsPressed && !GameRepo.IsWithinDialogueSpace)
PlayerLogic.Input(new PlayerLogic.Input.Attack());
MoveAndSlide();

View File

@@ -10,10 +10,15 @@
[ext_resource type="Texture2D" uid="uid://de55prolicl0u" path="res://src/player/slash_0004_Classic_26.png" id="6_ngag5"]
[ext_resource type="Texture2D" uid="uid://bp0msic3uk3kc" path="res://src/player/slash_0005_Layer-1.png" id="7_tp5uu"]
[sub_resource type="BoxShape3D" id="BoxShape3D_wedu3"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_dw45s"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_dmans"]
[sub_resource type="BoxShape3D" id="BoxShape3D_hs4wf"]
size = Vector3(1.94531, 2.43945, 1.08447)
[sub_resource type="Animation" id="Animation_hcjph"]
length = 0.001
tracks/0/type = "value"
@@ -75,8 +80,6 @@ _data = {
"attack": SubResource("Animation_0jjwv")
}
[sub_resource type="BoxShape3D" id="BoxShape3D_wedu3"]
[sub_resource type="SpriteFrames" id="SpriteFrames_ywvvo"]
animations = [{
"frames": [{
@@ -115,43 +118,16 @@ bg_color = Color(0, 0.411765, 0, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_onron"]
bg_color = Color(0, 0.411765, 0, 1)
[sub_resource type="BoxShape3D" id="BoxShape3D_hs4wf"]
size = Vector3(1.94531, 2.43945, 1.08447)
[node name="Player" type="CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.381018, 0)
collision_layer = 38
collision_mask = 7
axis_lock_linear_y = true
axis_lock_angular_x = true
axis_lock_angular_z = true
motion_mode = 1
script = ExtResource("1_xcol5")
RotationSpeed = 0.025
MoveSpeed = 3.0
Acceleration = 0.01
PlayerStatInfo = ExtResource("2_nuh2a")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.937567, 0)
shape = SubResource("CapsuleShape3D_dw45s")
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"]
visible = false
mesh = SubResource("CapsuleMesh_dmans")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.36136, 0.0347929)
cull_mask = 1048573
[node name="OmniLight3D" type="OmniLight3D" parent="."]
omni_range = 73.156
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
"": SubResource("AnimationLibrary_w8l8m")
}
[node name="Hitbox" type="Area3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -1)
@@ -163,6 +139,36 @@ script = ExtResource("2_lb3qc")
shape = SubResource("BoxShape3D_wedu3")
disabled = true
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.937567, 0)
shape = SubResource("CapsuleShape3D_dw45s")
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"]
mesh = SubResource("CapsuleMesh_dmans")
[node name="CollisionDetector" type="Area3D" parent="CollisionShape3D"]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.937567, 0)
collision_layer = 192
collision_mask = 128
[node name="CollisionShape3D" type="CollisionShape3D" parent="CollisionShape3D/CollisionDetector"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0479561, 0.982638, -0.04021)
shape = SubResource("BoxShape3D_hs4wf")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.163955, 1.13605, -0.159032)
cull_mask = 1048573
[node name="OmniLight3D" type="OmniLight3D" parent="."]
omni_range = 73.156
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
"": SubResource("AnimationLibrary_w8l8m")
}
[node name="SwordSlashAnimation" type="AnimatedSprite2D" parent="."]
unique_name_in_owner = true
scale = Vector2(9.03192, 6.39623)
@@ -215,12 +221,3 @@ custom_minimum_size = Vector2(0, 25)
layout_mode = 2
theme_override_styles/background = SubResource("StyleBoxFlat_onron")
show_percentage = false
[node name="CollisionDetector" type="Area3D" parent="."]
unique_name_in_owner = true
collision_layer = 64
collision_mask = 64
[node name="CollisionShape3D" type="CollisionShape3D" parent="CollisionDetector"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0479561, 0.982638, -0.04021)
shape = SubResource("BoxShape3D_hs4wf")