Loading works
Debug pickup
This commit is contained in:
@@ -3,4 +3,5 @@
|
|||||||
[ext_resource type="Script" uid="uid://cck757iieiyj5" path="res://src/Main.cs" id="1_prpoe"]
|
[ext_resource type="Script" uid="uid://cck757iieiyj5" path="res://src/Main.cs" id="1_prpoe"]
|
||||||
|
|
||||||
[node name="Node" type="Node"]
|
[node name="Node" type="Node"]
|
||||||
|
process_mode = 3
|
||||||
script = ExtResource("1_prpoe")
|
script = ExtResource("1_prpoe")
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ public partial class App : CanvasLayer, IApp
|
|||||||
// Load everything while we're showing a black screen, then fade in.
|
// Load everything while we're showing a black screen, then fade in.
|
||||||
HideMenus();
|
HideMenus();
|
||||||
Menu.Show();
|
Menu.Show();
|
||||||
Game.Show();
|
|
||||||
|
|
||||||
FadeInFromBlack();
|
FadeInFromBlack();
|
||||||
Menu.NewGameButton.GrabFocus();
|
Menu.NewGameButton.GrabFocus();
|
||||||
@@ -136,18 +135,14 @@ public partial class App : CanvasLayer, IApp
|
|||||||
|
|
||||||
public void OnAnimationFinished(StringName animation)
|
public void OnAnimationFinished(StringName animation)
|
||||||
{
|
{
|
||||||
// There's only two animations :)
|
|
||||||
// We don't care what state we're in — we just tell the current state what's
|
|
||||||
// happened and it will do the right thing.
|
|
||||||
|
|
||||||
if (animation == "fade_in")
|
if (animation == "fade_in")
|
||||||
{
|
{
|
||||||
AppLogic.Input(new AppLogic.Input.FadeInFinished());
|
AppLogic.Input(new FadeInFinished());
|
||||||
BlankScreen.Hide();
|
BlankScreen.Hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLogic.Input(new AppLogic.Input.FadeOutFinished());
|
AppLogic.Input(new FadeOutFinished());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnExitTree()
|
public void OnExitTree()
|
||||||
|
|||||||
@@ -4,21 +4,6 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://rfvnddfqufho" path="res://src/menu/Menu.tscn" id="2_kvwo1"]
|
[ext_resource type="PackedScene" uid="uid://rfvnddfqufho" path="res://src/menu/Menu.tscn" id="2_kvwo1"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bd0p761qakisw" path="res://src/menu/splash/Splash.tscn" id="3_3st5l"]
|
[ext_resource type="PackedScene" uid="uid://bd0p761qakisw" path="res://src/menu/splash/Splash.tscn" id="3_3st5l"]
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_1uiag"]
|
|
||||||
resource_name = "fade_in"
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath("BlankScreenControl/BlankScreen:color")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 1),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Color(0.270588, 0, 0, 1), Color(0, 0, 0, 0)]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_3st5l"]
|
[sub_resource type="Animation" id="Animation_3st5l"]
|
||||||
length = 0.001
|
length = 0.001
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
@@ -34,6 +19,21 @@ tracks/0/keys = {
|
|||||||
"values": [Color(0, 0, 0, 1)]
|
"values": [Color(0, 0, 0, 1)]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_1uiag"]
|
||||||
|
resource_name = "fade_in"
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("BlankScreenControl/BlankScreen:color")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 0)]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_v0mgf"]
|
[sub_resource type="Animation" id="Animation_v0mgf"]
|
||||||
resource_name = "fade_out"
|
resource_name = "fade_out"
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
@@ -46,7 +46,7 @@ tracks/0/keys = {
|
|||||||
"times": PackedFloat32Array(0, 1),
|
"times": PackedFloat32Array(0, 1),
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [Color(0, 0, 0, 0), Color(0, 0, 0.454902, 1)]
|
"values": [Color(0, 0, 0, 0), Color(0, 0, 0, 1)]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_3st5l"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_3st5l"]
|
||||||
|
|||||||
1
src/app/state/AppLogic.Data.cs.uid
Normal file
1
src/app/state/AppLogic.Data.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cbqvl36d7foae
|
||||||
@@ -15,8 +15,8 @@ public partial class AppLogic
|
|||||||
|
|
||||||
this.OnEnter(() =>
|
this.OnEnter(() =>
|
||||||
{
|
{
|
||||||
Get<IAppRepo>().OnEnterGame();
|
|
||||||
Output(new Output.ShowGame());
|
Output(new Output.ShowGame());
|
||||||
|
Get<IAppRepo>().OnEnterGame();
|
||||||
});
|
});
|
||||||
this.OnExit(() => Output(new Output.HideGame()));
|
this.OnExit(() => Output(new Output.HideGame()));
|
||||||
|
|
||||||
|
|||||||
1
src/app/state/states/AppLogic.State.InGame.cs.uid
Normal file
1
src/app/state/states/AppLogic.State.InGame.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://ckb88dvtckagu
|
||||||
1
src/app/state/states/AppLogic.State.LeavingMenu.cs.uid
Normal file
1
src/app/state/states/AppLogic.State.LeavingMenu.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://du7y6o0h004sm
|
||||||
@@ -14,6 +14,7 @@ public partial class AppLogic
|
|||||||
{
|
{
|
||||||
this.OnEnter(() => Output(new Output.StartLoadingSaveFile()));
|
this.OnEnter(() => Output(new Output.StartLoadingSaveFile()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Transition On(in Input.SaveFileLoaded input) => To<InGame>();
|
public Transition On(in Input.SaveFileLoaded input) => To<InGame>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://b5j2df20jd05i
|
||||||
1
src/app/state/states/AppLogic.State.MainMenu.cs.uid
Normal file
1
src/app/state/states/AppLogic.State.MainMenu.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://b5ehfb8l8u2fy
|
||||||
1
src/app/state/states/AppLogic.State.SplashScreen.cs.uid
Normal file
1
src/app/state/states/AppLogic.State.SplashScreen.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dxbrwt7jduxu8
|
||||||
@@ -188,8 +188,8 @@ public partial class Game : Node3D, IGame
|
|||||||
GameBinding
|
GameBinding
|
||||||
.Handle((in GameLogic.Output.StartGame _) =>
|
.Handle((in GameLogic.Output.StartGame _) =>
|
||||||
{
|
{
|
||||||
InGameUI.Show();
|
|
||||||
GameRepo.Resume();
|
GameRepo.Resume();
|
||||||
|
InGameUI.Show();
|
||||||
})
|
})
|
||||||
.Handle((in GameLogic.Output.GoToOverworld _) =>
|
.Handle((in GameLogic.Output.GoToOverworld _) =>
|
||||||
{
|
{
|
||||||
@@ -218,7 +218,7 @@ public partial class Game : Node3D, IGame
|
|||||||
.Handle((in GameLogic.Output.ExitLostScreen _) => { DeathMenu.FadeOut(); })
|
.Handle((in GameLogic.Output.ExitLostScreen _) => { DeathMenu.FadeOut(); })
|
||||||
.Handle((in GameLogic.Output.SaveGame _) =>
|
.Handle((in GameLogic.Output.SaveGame _) =>
|
||||||
{
|
{
|
||||||
Save();
|
SaveFile.Save();
|
||||||
AppRepo.OnExitGame();
|
AppRepo.OnExitGame();
|
||||||
GetTree().Quit();
|
GetTree().Quit();
|
||||||
// Back to title screen
|
// Back to title screen
|
||||||
@@ -248,16 +248,6 @@ public partial class Game : Node3D, IGame
|
|||||||
_effectService = new EffectService(this, Player);
|
_effectService = new EffectService(this, Player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
SaveFile.Save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Load()
|
|
||||||
{
|
|
||||||
SaveFile.Load();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadExistingGame()
|
public void LoadExistingGame()
|
||||||
{
|
{
|
||||||
SaveFile.Load()
|
SaveFile.Load()
|
||||||
@@ -493,6 +483,9 @@ public partial class Game : Node3D, IGame
|
|||||||
GameLogic.Input(new GameLogic.Input.PauseMenuTransitioned());
|
GameLogic.Input(new GameLogic.Input.PauseMenuTransitioned());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnStart() =>
|
||||||
|
GameLogic.Input(new GameLogic.Input.StartGame());
|
||||||
|
|
||||||
private void FinishedLoadingSaveFile()
|
private void FinishedLoadingSaveFile()
|
||||||
{
|
{
|
||||||
EmitSignal(SignalName.SaveFileLoaded);
|
EmitSignal(SignalName.SaveFileLoaded);
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ wait_time = 30.0
|
|||||||
|
|
||||||
[node name="InGameUI" parent="." instance=ExtResource("5_lxtnp")]
|
[node name="InGameUI" parent="." instance=ExtResource("5_lxtnp")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
|
|
||||||
[node name="InGameAudio" parent="." instance=ExtResource("6_qc71l")]
|
[node name="InGameAudio" parent="." instance=ExtResource("6_qc71l")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ GameJamDungeon_GameLogic_State_FloorClearedDecisionState --> GameJamDungeon_Game
|
|||||||
GameJamDungeon_GameLogic_State_FloorClearedDecisionState --> GameJamDungeon_GameLogic_State_Playing : HideFloorClearMenu
|
GameJamDungeon_GameLogic_State_FloorClearedDecisionState --> GameJamDungeon_GameLogic_State_Playing : HideFloorClearMenu
|
||||||
GameJamDungeon_GameLogic_State_FloorClearedDecisionState --> GameJamDungeon_GameLogic_State_Playing : SaveGame
|
GameJamDungeon_GameLogic_State_FloorClearedDecisionState --> GameJamDungeon_GameLogic_State_Playing : SaveGame
|
||||||
GameJamDungeon_GameLogic_State_InventoryOpened --> GameJamDungeon_GameLogic_State_Playing : CloseInventory
|
GameJamDungeon_GameLogic_State_InventoryOpened --> GameJamDungeon_GameLogic_State_Playing : CloseInventory
|
||||||
|
GameJamDungeon_GameLogic_State_MenuBackdrop --> GameJamDungeon_GameLogic_State_MenuBackdrop : Initialize
|
||||||
GameJamDungeon_GameLogic_State_MenuBackdrop --> GameJamDungeon_GameLogic_State_Playing : StartGame
|
GameJamDungeon_GameLogic_State_MenuBackdrop --> GameJamDungeon_GameLogic_State_Playing : StartGame
|
||||||
GameJamDungeon_GameLogic_State_MinimapOpen --> GameJamDungeon_GameLogic_State_Playing : MiniMapButtonReleased
|
GameJamDungeon_GameLogic_State_MinimapOpen --> GameJamDungeon_GameLogic_State_Playing : MiniMapButtonReleased
|
||||||
GameJamDungeon_GameLogic_State_Paused --> GameJamDungeon_GameLogic_State_Resuming : UnpauseGame
|
GameJamDungeon_GameLogic_State_Paused --> GameJamDungeon_GameLogic_State_Resuming : UnpauseGame
|
||||||
|
|||||||
@@ -41,9 +41,5 @@ public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvid
|
|||||||
|
|
||||||
public void EnemyDefeated(Vector3 defeatedLocation, EnemyStatResource enemyStatResource);
|
public void EnemyDefeated(Vector3 defeatedLocation, EnemyStatResource enemyStatResource);
|
||||||
|
|
||||||
public void Save();
|
|
||||||
|
|
||||||
public void Load();
|
|
||||||
|
|
||||||
public void TogglePause();
|
public void TogglePause();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public partial class GameLogic
|
|||||||
public partial record State
|
public partial record State
|
||||||
{
|
{
|
||||||
[Meta]
|
[Meta]
|
||||||
public partial record MenuBackdrop : State, IGet<Input.StartGame>
|
public partial record MenuBackdrop : State, IGet<Input.StartGame>, IGet<Input.Initialize>
|
||||||
{
|
{
|
||||||
public MenuBackdrop()
|
public MenuBackdrop()
|
||||||
{
|
{
|
||||||
@@ -17,7 +17,16 @@ public partial class GameLogic
|
|||||||
|
|
||||||
public void OnGameEntered() => Input(new Input.StartGame());
|
public void OnGameEntered() => Input(new Input.StartGame());
|
||||||
|
|
||||||
public Transition On(in Input.StartGame input) => To<Playing>();
|
public Transition On(in Input.StartGame input)
|
||||||
|
{
|
||||||
|
Get<IMap>().LoadMap();
|
||||||
|
return To<Playing>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Transition On(in Input.Initialize input)
|
||||||
|
{
|
||||||
|
return ToSelf();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://lwjsht36v6ut
|
||||||
@@ -189,7 +189,7 @@ namespace GameJamDungeon.src.items
|
|||||||
var randomRoom = roomsGodotCollection.PickRandom();
|
var randomRoom = roomsGodotCollection.PickRandom();
|
||||||
var spawnPoint = randomRoom.PlayerSpawn;
|
var spawnPoint = randomRoom.PlayerSpawn;
|
||||||
_game.ToggleInventory();
|
_game.ToggleInventory();
|
||||||
player.TeleportPlayer(spawnPoint.GlobalPosition);
|
player.TeleportPlayer(spawnPoint.Transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeAffinity(ThrowableItem throwableItem)
|
public void ChangeAffinity(ThrowableItem throwableItem)
|
||||||
@@ -207,7 +207,7 @@ namespace GameJamDungeon.src.items
|
|||||||
{
|
{
|
||||||
var exitRoom = _game.CurrentFloor.Rooms.OfType<ExitRoom>().Single();
|
var exitRoom = _game.CurrentFloor.Rooms.OfType<ExitRoom>().Single();
|
||||||
if (exitRoom.PlayerDiscoveredRoom)
|
if (exitRoom.PlayerDiscoveredRoom)
|
||||||
player.TeleportPlayer(exitRoom.PlayerSpawn.GlobalPosition);
|
player.TeleportPlayer(exitRoom.PlayerSpawn.Transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WarpToExit(IEnemy enemy)
|
public void WarpToExit(IEnemy enemy)
|
||||||
|
|||||||
@@ -21,27 +21,34 @@ public partial class DroppedItem : RigidBody3D, IDroppedItem
|
|||||||
|
|
||||||
[Node] private Sprite2D Sprite { get; set; } = default!;
|
[Node] private Sprite2D Sprite { get; set; } = default!;
|
||||||
|
|
||||||
|
[Node] private Area3D Pickup { get; set; } = default!;
|
||||||
|
|
||||||
public InventoryItem Item { get; set; }
|
public InventoryItem Item { get; set; }
|
||||||
|
|
||||||
public void OnResolved()
|
public void OnResolved()
|
||||||
{
|
{
|
||||||
ContactMonitor = true;
|
ContactMonitor = true;
|
||||||
BodyEntered += DroppedItem_BodyEntered;
|
|
||||||
Sprite.Texture = Item.ItemStats.Texture;
|
Sprite.Texture = Item.ItemStats.Texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Drop()
|
public async void Drop()
|
||||||
{
|
{
|
||||||
AddCollisionExceptionWith((Node)Player);
|
AddCollisionExceptionWith((Node)Player);
|
||||||
|
Pickup.Monitorable = false;
|
||||||
|
Pickup.Monitoring = false;
|
||||||
GlobalPosition = Player.CurrentPosition + Vector3.Up;
|
GlobalPosition = Player.CurrentPosition + Vector3.Up;
|
||||||
ApplyCentralImpulse(-Player.CurrentBasis.Z.Normalized() * 5.0f);
|
ApplyCentralImpulse(-Player.CurrentBasis.Z.Normalized() * 5.0f);
|
||||||
await ToSignal(GetTree().CreateTimer(1), "timeout");
|
await ToSignal(GetTree().CreateTimer(1), "timeout");
|
||||||
RemoveCollisionExceptionWith((Node)Player);
|
RemoveCollisionExceptionWith((Node)Player);
|
||||||
|
Pickup.Monitorable = true;
|
||||||
|
Pickup.Monitoring = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RescueItem()
|
public void RescueItem()
|
||||||
{
|
{
|
||||||
ContactMonitor = false;
|
ContactMonitor = false;
|
||||||
|
Pickup.Monitorable = false;
|
||||||
|
Pickup.Monitoring = false;
|
||||||
PlayRescueAnimation();
|
PlayRescueAnimation();
|
||||||
Game.RescuedItems.Items.Add(Item);
|
Game.RescuedItems.Items.Add(Item);
|
||||||
}
|
}
|
||||||
@@ -75,13 +82,4 @@ public partial class DroppedItem : RigidBody3D, IDroppedItem
|
|||||||
shaderMaterial.SetShaderParameter("reverse", shaderValue);
|
shaderMaterial.SetShaderParameter("reverse", shaderValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DroppedItem_BodyEntered(Node body)
|
|
||||||
{
|
|
||||||
if (body is IPlayer player)
|
|
||||||
{
|
|
||||||
var isAdded = player.Inventory.TryAdd(Item);
|
|
||||||
if (isAdded)
|
|
||||||
QueueFree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=9 format=3 uid="uid://brq11lswpqxei"]
|
[gd_scene load_steps=10 format=3 uid="uid://brq11lswpqxei"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://c2sps6uamyyw2" path="res://src/items/dropped/DroppedItem.cs" id="1_67jk4"]
|
[ext_resource type="Script" uid="uid://c2sps6uamyyw2" path="res://src/items/dropped/DroppedItem.cs" id="1_67jk4"]
|
||||||
[ext_resource type="Texture2D" uid="uid://mi70lolgtf3n" path="res://src/items/throwable/textures/GEOMANCER-DICE.png" id="2_cu1v3"]
|
[ext_resource type="Texture2D" uid="uid://mi70lolgtf3n" path="res://src/items/throwable/textures/GEOMANCER-DICE.png" id="2_cu1v3"]
|
||||||
@@ -47,6 +47,9 @@ _data = {
|
|||||||
[sub_resource type="ViewportTexture" id="ViewportTexture_x5q15"]
|
[sub_resource type="ViewportTexture" id="ViewportTexture_x5q15"]
|
||||||
viewport_path = NodePath("Sprite3D/SubViewportContainer/SubViewport")
|
viewport_path = NodePath("Sprite3D/SubViewportContainer/SubViewport")
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_eat5q"]
|
||||||
|
radius = 0.47
|
||||||
|
|
||||||
[node name="DroppedItem" type="RigidBody3D"]
|
[node name="DroppedItem" type="RigidBody3D"]
|
||||||
collision_layer = 1024
|
collision_layer = 1024
|
||||||
collision_mask = 5
|
collision_mask = 5
|
||||||
@@ -92,3 +95,11 @@ scale = Vector2(0.1, 0.1)
|
|||||||
texture = ExtResource("2_cu1v3")
|
texture = ExtResource("2_cu1v3")
|
||||||
centered = false
|
centered = false
|
||||||
offset = Vector2(2000, 2000)
|
offset = Vector2(2000, 2000)
|
||||||
|
|
||||||
|
[node name="Pickup" type="Area3D" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
collision_layer = 4
|
||||||
|
collision_mask = 0
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="Pickup"]
|
||||||
|
shape = SubResource("CapsuleShape3D_eat5q")
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ namespace GameJamDungeon;
|
|||||||
|
|
||||||
public interface IMap : INode3D, IProvide<ISaveChunk<MapData>>
|
public interface IMap : INode3D, IProvide<ISaveChunk<MapData>>
|
||||||
{
|
{
|
||||||
|
public void LoadMap();
|
||||||
|
|
||||||
public List<string> FloorScenes { get; }
|
public List<string> FloorScenes { get; }
|
||||||
|
|
||||||
public IDungeonFloor CurrentFloor { get; }
|
public IDungeonFloor CurrentFloor { get; }
|
||||||
@@ -49,7 +51,7 @@ public partial class Map : Node3D, IMap
|
|||||||
|
|
||||||
public void OnResolved()
|
public void OnResolved()
|
||||||
{
|
{
|
||||||
FloorScenes = new List<string>();
|
FloorScenes = [];
|
||||||
|
|
||||||
MapChunk = new SaveChunk<MapData>(
|
MapChunk = new SaveChunk<MapData>(
|
||||||
onSave: (chunk) => new MapData()
|
onSave: (chunk) => new MapData()
|
||||||
@@ -65,11 +67,19 @@ public partial class Map : Node3D, IMap
|
|||||||
GameChunk.AddChunk(MapChunk);
|
GameChunk.AddChunk(MapChunk);
|
||||||
|
|
||||||
this.Provide();
|
this.Provide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadMap()
|
||||||
|
{
|
||||||
foreach (var floor in _floors)
|
foreach (var floor in _floors)
|
||||||
FloorScenes.Add(floor.ResourcePath);
|
FloorScenes.Add(floor.ResourcePath);
|
||||||
|
|
||||||
LoadFloor();
|
LoadFloor();
|
||||||
|
CurrentFloor.InitializeDungeon();
|
||||||
|
var transform = GetPlayerSpawnPosition();
|
||||||
|
Player.TeleportPlayer(transform);
|
||||||
|
CurrentFloor.FloorIsLoaded = true;
|
||||||
|
Game.NextFloorLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SpawnNextFloor()
|
public void SpawnNextFloor()
|
||||||
@@ -79,7 +89,7 @@ public partial class Map : Node3D, IMap
|
|||||||
LoadFloor();
|
LoadFloor();
|
||||||
CurrentFloor.InitializeDungeon();
|
CurrentFloor.InitializeDungeon();
|
||||||
var transform = GetPlayerSpawnPosition();
|
var transform = GetPlayerSpawnPosition();
|
||||||
Player.TeleportPlayer(new Vector3(transform.Origin.X, -1.75f, transform.Origin.Z));
|
Player.TeleportPlayer(transform);
|
||||||
CurrentFloor.FloorIsLoaded = true;
|
CurrentFloor.FloorIsLoaded = true;
|
||||||
Game.NextFloorLoaded();
|
Game.NextFloorLoaded();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace GameJamDungeon
|
|||||||
DungeonGenerator.EmitSignal("done_generating");
|
DungeonGenerator.EmitSignal("done_generating");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Transform3D GetPlayerSpawnPoint() => _playerSpawnPoint;
|
public Transform3D GetPlayerSpawnPoint() => new Transform3D(_playerSpawnPoint.Basis, new Vector3(_playerSpawnPoint.Origin.X, -1.75f, _playerSpawnPoint.Origin.Z));
|
||||||
|
|
||||||
private Transform3D RandomizePlayerSpawnPoint()
|
private Transform3D RandomizePlayerSpawnPoint()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,6 +30,6 @@ public partial class Floor0 : Node3D, IDungeonFloor
|
|||||||
private void Exit_AreaEntered(Area3D area) => ExitReached();
|
private void Exit_AreaEntered(Area3D area) => ExitReached();
|
||||||
|
|
||||||
public void ExitReached() => Game.FloorExitReached();
|
public void ExitReached() => Game.FloorExitReached();
|
||||||
public void InitializeDungeon() => throw new System.NotImplementedException();
|
public void InitializeDungeon() { return; }
|
||||||
public Transform3D GetPlayerSpawnPoint() => throw new System.NotImplementedException();
|
public Transform3D GetPlayerSpawnPoint() { return new Transform3D(PlayerSpawnPoint.Basis, new Vector3(PlayerSpawnPoint.GlobalPosition.X, -3, PlayerSpawnPoint.GlobalPosition.Z)); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -896,7 +896,3 @@ shape = SubResource("BoxShape3D_db2o3")
|
|||||||
|
|
||||||
[node name="Camera3D" type="Camera3D" parent="."]
|
[node name="Camera3D" type="Camera3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.00384, 1.80761, 11.3571)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.00384, 1.80761, 11.3571)
|
||||||
|
|
||||||
[node name="CSGBox3D" type="CSGBox3D" parent="."]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.22872, 0)
|
|
||||||
size = Vector3(1, 1.7, 1)
|
|
||||||
|
|||||||
@@ -2,6 +2,21 @@
|
|||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cl3shd6l7frmg" path="res://src/menu/splash/Splash.cs" id="1_7ivmr"]
|
[ext_resource type="Script" uid="uid://cl3shd6l7frmg" path="res://src/menu/splash/Splash.cs" id="1_7ivmr"]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_jiqgw"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("ColorRect:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_7ivmr"]
|
[sub_resource type="Animation" id="Animation_7ivmr"]
|
||||||
resource_name = "intro"
|
resource_name = "intro"
|
||||||
length = 3.0
|
length = 3.0
|
||||||
@@ -18,21 +33,6 @@ tracks/0/keys = {
|
|||||||
"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 0)]
|
"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 0)]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_jiqgw"]
|
|
||||||
length = 0.001
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath("ColorRect:modulate")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0),
|
|
||||||
"transitions": PackedFloat32Array(1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Color(1, 1, 1, 1)]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_jiqgw"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_jiqgw"]
|
||||||
_data = {
|
_data = {
|
||||||
&"RESET": SubResource("Animation_jiqgw"),
|
&"RESET": SubResource("Animation_jiqgw"),
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public interface IPlayer : IKillable, IProvide<ISaveChunk<PlayerData>>
|
|||||||
|
|
||||||
public void Move(float delta);
|
public void Move(float delta);
|
||||||
|
|
||||||
public void TeleportPlayer(Vector3 newPosition);
|
public void TeleportPlayer(Transform3D newTransform);
|
||||||
|
|
||||||
public IDungeonRoom GetCurrentRoom();
|
public IDungeonRoom GetCurrentRoom();
|
||||||
|
|
||||||
|
|||||||
@@ -160,6 +160,9 @@ public partial class Player : CharacterBody3D, IPlayer
|
|||||||
Equip(defaultArmor);
|
Equip(defaultArmor);
|
||||||
|
|
||||||
HealthTimer.WaitTime = _healthTimerWaitTime;
|
HealthTimer.WaitTime = _healthTimerWaitTime;
|
||||||
|
HealthTimer.Timeout += OnHealthTimerTimeout;
|
||||||
|
Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||||
|
CollisionDetector.AreaEntered += CollisionDetector_AreaEntered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnResolved()
|
public void OnResolved()
|
||||||
@@ -211,9 +214,6 @@ public partial class Player : CharacterBody3D, IPlayer
|
|||||||
|
|
||||||
PlayerLogic.Start();
|
PlayerLogic.Start();
|
||||||
this.Provide();
|
this.Provide();
|
||||||
HealthTimer.Timeout += OnHealthTimerTimeout;
|
|
||||||
Hitbox.AreaEntered += Hitbox_AreaEntered;
|
|
||||||
CollisionDetector.AreaEntered += CollisionDetector_AreaEntered;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CollisionDetector_AreaEntered(Area3D area)
|
private void CollisionDetector_AreaEntered(Area3D area)
|
||||||
@@ -229,6 +229,17 @@ public partial class Player : CharacterBody3D, IPlayer
|
|||||||
else
|
else
|
||||||
Game.AnnounceMessageOnMainScreen($"Could not pick up {inventoryItem.ItemName}.");
|
Game.AnnounceMessageOnMainScreen($"Could not pick up {inventoryItem.ItemName}.");
|
||||||
}
|
}
|
||||||
|
if (area.GetParent() is DroppedItem droppedItem)
|
||||||
|
{
|
||||||
|
var isAdded = Inventory.TryAdd(droppedItem.Item);
|
||||||
|
if (isAdded)
|
||||||
|
{
|
||||||
|
Game.AnnounceMessageOnMainScreen($"{droppedItem.Item.ItemName} picked up.");
|
||||||
|
droppedItem.QueueFree();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Game.AnnounceMessageOnMainScreen($"Could not pick up {droppedItem.Item.ItemName}.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnReady()
|
public void OnReady()
|
||||||
@@ -337,9 +348,9 @@ public partial class Player : CharacterBody3D, IPlayer
|
|||||||
MoveAndSlide();
|
MoveAndSlide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TeleportPlayer(Vector3 newPosition)
|
public void TeleportPlayer(Transform3D newTransform)
|
||||||
{
|
{
|
||||||
GlobalPosition = newPosition;
|
Transform = newTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TakeDamage(double damage, ElementType elementType, bool isCriticalHit = false)
|
public void TakeDamage(double damage, ElementType elementType, bool isCriticalHit = false)
|
||||||
@@ -389,12 +400,6 @@ public partial class Player : CharacterBody3D, IPlayer
|
|||||||
|
|
||||||
if (@event.IsActionPressed(GameInputs.Attack))
|
if (@event.IsActionPressed(GameInputs.Attack))
|
||||||
Attack();
|
Attack();
|
||||||
|
|
||||||
if (@event.IsActionPressed(GameInputs.Save))
|
|
||||||
Game.Save();
|
|
||||||
|
|
||||||
if (@event.IsActionPressed(GameInputs.Load))
|
|
||||||
Game.Load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPhysicsProcess(double delta)
|
public void OnPhysicsProcess(double delta)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ radius = 1.0
|
|||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_wedu3"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_wedu3"]
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_hs4wf"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_hs4wf"]
|
||||||
size = Vector3(1.94531, 3.38623, 2.35425)
|
size = Vector3(1.94531, 3.38623, 1.50671)
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_hcjph"]
|
[sub_resource type="Animation" id="Animation_hcjph"]
|
||||||
length = 0.001
|
length = 0.001
|
||||||
@@ -495,7 +495,7 @@ collision_layer = 452
|
|||||||
collision_mask = 452
|
collision_mask = 452
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="CollisionDetector"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="CollisionDetector"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0479561, 0.509249, -0.675098)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0479561, 0.509249, -0.25133)
|
||||||
shape = SubResource("BoxShape3D_hs4wf")
|
shape = SubResource("BoxShape3D_hs4wf")
|
||||||
|
|
||||||
[node name="Camera3D" type="Camera3D" parent="."]
|
[node name="Camera3D" type="Camera3D" parent="."]
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
[gd_scene load_steps=7 format=3 uid="uid://b1muxus5qdbeu"]
|
[gd_scene load_steps=7 format=3 uid="uid://b1muxus5qdbeu"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/ui/in_game_ui/InGameUI.cs" id="1_sc13i"]
|
[ext_resource type="Script" uid="uid://dlq2mkhl4pe7a" path="res://src/ui/in_game_ui/InGameUI.cs" id="1_sc13i"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bwbofurcvf3yh" path="res://src/minimap/Minimap.tscn" id="2_6sfje"]
|
[ext_resource type="PackedScene" uid="uid://bwbofurcvf3yh" path="res://src/minimap/Minimap.tscn" id="2_6sfje"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dlj8qdg1c5048" path="res://src/inventory_menu/InventoryMenu.tscn" id="3_4vcdl"]
|
[ext_resource type="PackedScene" uid="uid://dlj8qdg1c5048" path="res://src/inventory_menu/InventoryMenu.tscn" id="3_4vcdl"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dxl8il8f13c2x" path="res://src/ui/player_ui/PlayerInfoUI.tscn" id="4_46s5l"]
|
[ext_resource type="PackedScene" uid="uid://dxl8il8f13c2x" path="res://src/ui/player_ui/PlayerInfoUI.tscn" id="4_46s5l"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bea2waybmgd6u" path="res://src/ui/teleport_prompt/UseTeleportPrompt.tscn" id="5_h1hgq"]
|
[ext_resource type="PackedScene" uid="uid://bea2waybmgd6u" path="res://src/ui/teleport_prompt/UseTeleportPrompt.tscn" id="5_h1hgq"]
|
||||||
[ext_resource type="Script" path="res://src/utils/FpsCounter.cs" id="7_c6o8j"]
|
[ext_resource type="Script" uid="uid://dj6oqler47dqf" path="res://src/utils/FpsCounter.cs" id="7_c6o8j"]
|
||||||
|
|
||||||
[node name="InGameUI" type="Control"]
|
[node name="InGameUI" type="Control"]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://dxl8il8f13c2x"]
|
[gd_scene load_steps=5 format=3 uid="uid://dxl8il8f13c2x"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://hg2kraa5nrnl" path="res://src/ui/textures/blank level symbol.png" id="1_78qrq"]
|
[ext_resource type="Texture2D" uid="uid://hg2kraa5nrnl" path="res://src/ui/textures/blank level symbol.png" id="1_78qrq"]
|
||||||
[ext_resource type="Script" path="res://src/ui/player_ui/PlayerInfoUI.cs" id="1_d8yyu"]
|
[ext_resource type="Script" uid="uid://b65cbirtijlii" path="res://src/ui/player_ui/PlayerInfoUI.cs" id="1_d8yyu"]
|
||||||
[ext_resource type="LabelSettings" uid="uid://ca1q6yu8blwxf" path="res://src/ui/label_settings/InventoryMainTextBold.tres" id="2_aa7fx"]
|
[ext_resource type="LabelSettings" uid="uid://ca1q6yu8blwxf" path="res://src/ui/label_settings/InventoryMainTextBold.tres" id="2_aa7fx"]
|
||||||
[ext_resource type="LabelSettings" uid="uid://dupifadnagodp" path="res://src/ui/label_settings/MainTextRegular.tres" id="3_xdjh1"]
|
[ext_resource type="LabelSettings" uid="uid://dupifadnagodp" path="res://src/ui/label_settings/MainTextRegular.tres" id="3_xdjh1"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user