Small tweak to floor number display, increased chinthe speed, fix Return To Overworld option on floor clear menu
This commit is contained in:
@@ -12,6 +12,8 @@ public partial class GameState
|
||||
|
||||
public readonly record struct LoadNextFloor;
|
||||
|
||||
public readonly record struct ReturnToOverworld;
|
||||
|
||||
public readonly record struct InventoryButtonPressed;
|
||||
|
||||
public readonly record struct InteractButtonPressed;
|
||||
|
||||
@@ -20,6 +20,8 @@ public partial class GameState
|
||||
|
||||
public readonly record struct LoadNextFloor;
|
||||
|
||||
public readonly record struct ReturnToOverworld;
|
||||
|
||||
public readonly record struct OpenTeleportScreen;
|
||||
|
||||
public readonly record struct OpenFloorExitScreen;
|
||||
|
||||
+7
-1
@@ -8,7 +8,7 @@ public partial class GameState
|
||||
public partial record State
|
||||
{
|
||||
[Meta, LogicBlock(typeof(State), Diagram = true)]
|
||||
public partial record FloorExitScreen : State, IGet<Input.LoadNextFloor>
|
||||
public partial record FloorExitScreen : State, IGet<Input.LoadNextFloor>, IGet<Input.ReturnToOverworld>
|
||||
{
|
||||
public FloorExitScreen()
|
||||
{
|
||||
@@ -20,6 +20,12 @@ public partial class GameState
|
||||
Output(new Output.LoadNextFloor());
|
||||
return To<InGame>();
|
||||
}
|
||||
|
||||
public Transition On(in Input.ReturnToOverworld input)
|
||||
{
|
||||
Output(new Output.ReturnToOverworld());
|
||||
return To<InGame>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.46013, 0)
|
||||
|
||||
[node name="FollowBehavior" parent="Components" instance=ExtResource("6_t7elt")]
|
||||
unique_name_in_owner = true
|
||||
_followSpeed = 500.0
|
||||
FollowSpeed = 800.0
|
||||
|
||||
[node name="EngagePlayerBehavior" parent="Components" instance=ExtResource("7_24q6i")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -415,7 +415,6 @@ public partial class Game : Node3D, IGame
|
||||
})
|
||||
.Handle((in GameState.Output.LoadNextFloor _) =>
|
||||
{
|
||||
LoadNextLevel.FadeOut();
|
||||
EmitSignal(SignalName.OnLoadLevelRequest);
|
||||
Task.Run(() => Save());
|
||||
if (_player.EquipmentComponent.EquippedWeapon.Value.ItemTag == ItemTag.BreaksOnFloorExit)
|
||||
@@ -438,6 +437,12 @@ public partial class Game : Node3D, IGame
|
||||
}
|
||||
LoadNextLevel.FadeOut();
|
||||
})
|
||||
.Handle((in GameState.Output.ReturnToOverworld _) =>
|
||||
{
|
||||
LoadNextLevel.FadeOut();
|
||||
Task.Run(() => Save());
|
||||
InitializeGame();
|
||||
})
|
||||
.Handle((in GameState.Output.ExitGame _) =>
|
||||
{
|
||||
OnQuit();
|
||||
@@ -453,11 +458,7 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
public void SetAffinity(ElementType elementType) => InGameUI.SetAffinity(elementType);
|
||||
|
||||
private void FloorClearMenu_Exit()
|
||||
{
|
||||
_player.Deactivate();
|
||||
InGameUI.Hide();
|
||||
}
|
||||
private void FloorClearMenu_Exit() => GameState.Input(new GameState.Input.ReturnToOverworld());
|
||||
|
||||
private void ExitInventoryAction() => GameState.Input(new GameState.Input.CloseInventory());
|
||||
|
||||
|
||||
@@ -3,4 +3,6 @@ using Godot;
|
||||
namespace Zennysoft.Game.Ma;
|
||||
public abstract partial class FloorNode : Node
|
||||
{
|
||||
[Export]
|
||||
public string DisplayedFloorNumber { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ public interface IMap : INode3D
|
||||
|
||||
public AutoProp<int> CurrentFloorNumber { get; }
|
||||
|
||||
AutoProp<string> CurrentFloorDisplayString { get; }
|
||||
|
||||
public event Action<(Vector3 Rotation, Vector3 Position)> SpawnPointCreated;
|
||||
|
||||
public event Action FloorLoaded;
|
||||
|
||||
@@ -27,6 +27,8 @@ public partial class Map : Node3D, IMap
|
||||
|
||||
public AutoProp<int> CurrentFloorNumber { get; private set; } = new AutoProp<int>(0);
|
||||
|
||||
public AutoProp<string> CurrentFloorDisplayString { get; private set; } = new AutoProp<string>(string.Empty);
|
||||
|
||||
private readonly string _floorFilePath = @"res://src/map/dungeon/floors/";
|
||||
|
||||
public event Action<(Vector3 Rotation, Vector3 Position)> SpawnPointCreated;
|
||||
@@ -60,6 +62,7 @@ public partial class Map : Node3D, IMap
|
||||
var floor = MapOrder.GetChildren().OfType<FloorNode>().ElementAt(CurrentFloorNumber.Value);
|
||||
if (CurrentFloor is DungeonFloor dungeonFloor && floor is DungeonFloorNode dungeonFloorNode)
|
||||
dungeonFloor.SpawnEnemies(dungeonFloorNode);
|
||||
CurrentFloorDisplayString.OnNext(floor.DisplayedFloorNumber);
|
||||
}
|
||||
|
||||
public void FadeIn() => AnimationPlayer.Play("fade_in");
|
||||
|
||||
@@ -81,6 +81,7 @@ FolderName = "Floor01"
|
||||
FloorOdds = Array[float]([0.33, 0.33, 0.33])
|
||||
Sproingy = 0.5
|
||||
Michael = 0.5
|
||||
DisplayedFloorNumber = "01"
|
||||
|
||||
[node name="Floor02" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
@@ -91,6 +92,7 @@ Michael = 0.5
|
||||
FilthEater = 0.1
|
||||
GoldSproingy = 0.05
|
||||
TrueRedAmbassador = 0.3
|
||||
DisplayedFloorNumber = "02"
|
||||
|
||||
[node name="Floor03" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
@@ -102,6 +104,7 @@ FilthEater = 0.3
|
||||
Sara = 0.1
|
||||
GoldSproingy = 0.05
|
||||
TrueRedAmbassador = 0.3
|
||||
DisplayedFloorNumber = "03"
|
||||
|
||||
[node name="Floor04" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
@@ -111,6 +114,7 @@ FilthEater = 0.5
|
||||
Sara = 0.3
|
||||
AgniDemon = 0.3
|
||||
GoldSproingy = 0.05
|
||||
DisplayedFloorNumber = "04"
|
||||
|
||||
[node name="Floor05" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
@@ -122,6 +126,7 @@ Ballos = 0.4
|
||||
RedAmbassador = 0.3
|
||||
AgniDemon = 0.5
|
||||
GoldSproingy = 0.05
|
||||
DisplayedFloorNumber = "05"
|
||||
|
||||
[node name="Floor06" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
@@ -132,6 +137,7 @@ Ballos = 0.5
|
||||
RedAmbassador = 0.3
|
||||
AgniDemon = 0.5
|
||||
GoldSproingy = 0.05
|
||||
DisplayedFloorNumber = "06"
|
||||
|
||||
[node name="Floor07" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
@@ -142,10 +148,12 @@ Ballos = 0.5
|
||||
RedAmbassador = 0.3
|
||||
AgniDemon = 0.4
|
||||
GoldSproingy = 0.05
|
||||
DisplayedFloorNumber = "07"
|
||||
|
||||
[node name="Boss Floor 1" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("3_v14r0")
|
||||
FloorName = 2
|
||||
DisplayedFloorNumber = "???"
|
||||
|
||||
[node name="Floor09" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
@@ -153,6 +161,7 @@ FolderName = "Floor09"
|
||||
FloorOdds = Array[float]([0.5, 0.5])
|
||||
Chinthe = 0.5
|
||||
GreenAmbassador = 0.1
|
||||
DisplayedFloorNumber = "09"
|
||||
|
||||
[node name="Floor10" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
@@ -161,6 +170,7 @@ FloorOdds = Array[float]([0.5, 0.5])
|
||||
Chinthe = 0.5
|
||||
GreenAmbassador = 0.5
|
||||
ShieldOfHeaven = 0.1
|
||||
DisplayedFloorNumber = "10"
|
||||
|
||||
[node name="Floor11" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
@@ -169,6 +179,7 @@ FloorOdds = Array[float]([0.5, 0.5])
|
||||
Chinthe = 0.5
|
||||
GreenAmbassador = 0.5
|
||||
ShieldOfHeaven = 0.5
|
||||
DisplayedFloorNumber = "11"
|
||||
|
||||
[node name="Floor12" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
@@ -177,6 +188,7 @@ FloorOdds = Array[float]([0.5, 0.5])
|
||||
GreenAmbassador = 0.5
|
||||
SteelAmbassador = 0.05
|
||||
ShieldOfHeaven = 0.5
|
||||
DisplayedFloorNumber = "12"
|
||||
|
||||
[node name="Floor13" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
@@ -187,6 +199,7 @@ GreenAmbassador = 0.25
|
||||
SteelAmbassador = 0.05
|
||||
Palan = 0.3
|
||||
ShieldOfHeaven = 0.5
|
||||
DisplayedFloorNumber = "13"
|
||||
|
||||
[node name="Floor14" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
@@ -196,24 +209,29 @@ SteelAmbassador = 0.05
|
||||
Palan = 0.5
|
||||
ShieldOfHeaven = 0.5
|
||||
GoldSproingy = 0.05
|
||||
DisplayedFloorNumber = "14"
|
||||
|
||||
[node name="Floor15" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
FolderName = "Floor15"
|
||||
FloorOdds = Array[float]([1.0])
|
||||
Sproingy = 1.0
|
||||
DisplayedFloorNumber = "15"
|
||||
|
||||
[node name="Boss Floor 2" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("3_v14r0")
|
||||
FloorName = 3
|
||||
DisplayedFloorNumber = "???"
|
||||
|
||||
[node name="Goddess of Guidance Floor" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("3_v14r0")
|
||||
FloorName = 4
|
||||
DisplayedFloorNumber = "???"
|
||||
|
||||
[node name="Final Floor" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("3_v14r0")
|
||||
FloorName = 6
|
||||
DisplayedFloorNumber = "???"
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
anchors_preset = 15
|
||||
|
||||
@@ -21,7 +21,7 @@ public partial class Minimap : Control
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
_map.CurrentFloorNumber.Sync += CurrentFloorNumber_Sync;
|
||||
_map.CurrentFloorDisplayString.Sync += CurrentFloorNumber_Sync;
|
||||
_ready = true;
|
||||
}
|
||||
|
||||
@@ -31,13 +31,13 @@ public partial class Minimap : Control
|
||||
MinimapCamera.Position = new Vector3(_player.GlobalPosition.X, MinimapCamera.Position.Y, _player.GlobalPosition.Z);
|
||||
}
|
||||
|
||||
private void CurrentFloorNumber_Sync(int obj)
|
||||
private void CurrentFloorNumber_Sync(string obj)
|
||||
{
|
||||
LayerNumberText.Text = $"{obj:D2}";
|
||||
LayerNumberText.Text = obj;
|
||||
}
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
_map.CurrentFloorNumber.Sync -= CurrentFloorNumber_Sync;
|
||||
_map.CurrentFloorDisplayString.Sync -= CurrentFloorNumber_Sync;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,19 +43,7 @@ public partial class LoadNextLevel : Control, IFloorClearMenu
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
_player.ExperiencePointsComponent.Level.Sync += Level_Sync;
|
||||
_player.ExperiencePointsComponent.CurrentExp.Sync += Exp_Sync;
|
||||
_player.ExperiencePointsComponent.ExpToNextLevel.Sync += Exp_Sync;
|
||||
_player.HealthComponent.CurrentHP.Sync += HP_Sync;
|
||||
_player.HealthComponent.MaximumHP.Sync += HP_Sync;
|
||||
_player.VTComponent.CurrentVT.Sync += VT_Sync;
|
||||
_player.VTComponent.MaximumVT.Sync += VT_Sync;
|
||||
_player.AttackComponent.CurrentAttack.Sync += Attack_Sync;
|
||||
_player.AttackComponent.MaximumAttack.Sync += Attack_Sync;
|
||||
_player.DefenseComponent.CurrentDefense.Sync += Defense_Sync;
|
||||
_player.DefenseComponent.MaximumDefense.Sync += Defense_Sync;
|
||||
_player.EquipmentComponent.EquipmentChanged += EquipmentComponent_EquipmentChanged;
|
||||
_map.CurrentFloorNumber.Sync += CurrentFloorNumber_Sync;
|
||||
EnableUISync();
|
||||
|
||||
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
|
||||
AnimationPlayer.AnimationStarted += AnimationPlayer_AnimationStarted;
|
||||
@@ -104,6 +92,7 @@ public partial class LoadNextLevel : Control, IFloorClearMenu
|
||||
}
|
||||
if (animName == "fade_out")
|
||||
{
|
||||
DisableUISync();
|
||||
_fadingIn = false;
|
||||
ContinueButton.CallDeferred(MethodName.ReleaseFocus);
|
||||
}
|
||||
@@ -119,6 +108,43 @@ public partial class LoadNextLevel : Control, IFloorClearMenu
|
||||
ExitButton.FocusMode = FocusModeEnum.All;
|
||||
}
|
||||
if (animName == "fade_out")
|
||||
{
|
||||
EnableUISync();
|
||||
TransitionCompleted?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableUISync()
|
||||
{
|
||||
_player.ExperiencePointsComponent.Level.Sync += Level_Sync;
|
||||
_player.ExperiencePointsComponent.CurrentExp.Sync += Exp_Sync;
|
||||
_player.ExperiencePointsComponent.ExpToNextLevel.Sync += Exp_Sync;
|
||||
_player.HealthComponent.CurrentHP.Sync += HP_Sync;
|
||||
_player.HealthComponent.MaximumHP.Sync += HP_Sync;
|
||||
_player.VTComponent.CurrentVT.Sync += VT_Sync;
|
||||
_player.VTComponent.MaximumVT.Sync += VT_Sync;
|
||||
_player.AttackComponent.CurrentAttack.Sync += Attack_Sync;
|
||||
_player.AttackComponent.MaximumAttack.Sync += Attack_Sync;
|
||||
_player.DefenseComponent.CurrentDefense.Sync += Defense_Sync;
|
||||
_player.DefenseComponent.MaximumDefense.Sync += Defense_Sync;
|
||||
_player.EquipmentComponent.EquipmentChanged += EquipmentComponent_EquipmentChanged;
|
||||
_map.CurrentFloorNumber.Sync += CurrentFloorNumber_Sync;
|
||||
}
|
||||
|
||||
private void DisableUISync()
|
||||
{
|
||||
_player.ExperiencePointsComponent.Level.Sync -= Level_Sync;
|
||||
_player.ExperiencePointsComponent.CurrentExp.Sync -= Exp_Sync;
|
||||
_player.ExperiencePointsComponent.ExpToNextLevel.Sync -= Exp_Sync;
|
||||
_player.HealthComponent.CurrentHP.Sync -= HP_Sync;
|
||||
_player.HealthComponent.MaximumHP.Sync -= HP_Sync;
|
||||
_player.VTComponent.CurrentVT.Sync -= VT_Sync;
|
||||
_player.VTComponent.MaximumVT.Sync -= VT_Sync;
|
||||
_player.AttackComponent.CurrentAttack.Sync -= Attack_Sync;
|
||||
_player.AttackComponent.MaximumAttack.Sync -= Attack_Sync;
|
||||
_player.DefenseComponent.CurrentDefense.Sync -= Defense_Sync;
|
||||
_player.DefenseComponent.MaximumDefense.Sync -= Defense_Sync;
|
||||
_player.EquipmentComponent.EquipmentChanged -= EquipmentComponent_EquipmentChanged;
|
||||
_map.CurrentFloorNumber.Sync -= CurrentFloorNumber_Sync;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user