diff --git a/Zennysoft.Game.Ma.Implementation/Game/GameRepo.cs b/Zennysoft.Game.Ma.Implementation/Game/GameRepo.cs index 709538b1..9e7f8435 100644 --- a/Zennysoft.Game.Ma.Implementation/Game/GameRepo.cs +++ b/Zennysoft.Game.Ma.Implementation/Game/GameRepo.cs @@ -1,6 +1,5 @@ using Chickensoft.Collections; using Godot; -using System; namespace Zennysoft.Game.Ma.Implementation; @@ -11,38 +10,22 @@ public interface IGameRepo : IDisposable void Resume(); IAutoProp IsPaused { get; } - - void SetPlayerGlobalTransform(Transform3D playerGlobalTransform); - - public int MaxItemSize { get; } - - public int EXPRate { get; set; } - - public int CurrentFloor { get; set; } } public class GameRepo : IGameRepo { public event Action? Ended; - public IAutoProp PlayerGlobalTransform => _playerGlobalTransform; - private readonly AutoProp _playerGlobalTransform; - public IAutoProp IsPaused => _isPaused; private readonly AutoProp _isPaused; public int MaxItemSize => 20; - public int EXPRate { get; set; } = 1; - private bool _disposedValue; - public int CurrentFloor { get; set; } = 0; - public GameRepo() { _isPaused = new AutoProp(true); - _playerGlobalTransform = new AutoProp(Transform3D.Identity); } public void Pause() @@ -57,8 +40,6 @@ public class GameRepo : IGameRepo GD.Print("Resume"); } - public void SetPlayerGlobalTransform(Transform3D playerGlobalTransform) => _playerGlobalTransform.OnNext(playerGlobalTransform); - public void OnGameEnded() { Pause(); diff --git a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.AskForTeleport.cs.uid b/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.AskForTeleport.cs.uid deleted file mode 100644 index 69151c77..00000000 --- a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.AskForTeleport.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://boai3f4vwgree diff --git a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.FloorCleared.cs.uid b/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.FloorCleared.cs.uid deleted file mode 100644 index cfe76aeb..00000000 --- a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.FloorCleared.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dw1wcux7lcpqy diff --git a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.GameStarted.cs.uid b/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.GameStarted.cs.uid deleted file mode 100644 index c58d6c5a..00000000 --- a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.GameStarted.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://cpu75lmblmbj4 diff --git a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.InventoryOpened.cs.uid b/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.InventoryOpened.cs.uid deleted file mode 100644 index 3d04a10e..00000000 --- a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.InventoryOpened.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dmbireek8b68t diff --git a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.MenuBackdrop.cs.uid b/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.MenuBackdrop.cs.uid deleted file mode 100644 index 6a78b899..00000000 --- a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.MenuBackdrop.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://lwjsht36v6ut diff --git a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.MiniMapOpen.cs.uid b/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.MiniMapOpen.cs.uid deleted file mode 100644 index 08ac9b96..00000000 --- a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.MiniMapOpen.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://nlpm8t4dege2 diff --git a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.Paused.cs.uid b/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.Paused.cs.uid deleted file mode 100644 index 6ce4c990..00000000 --- a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.Paused.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://c46publoqhqsn diff --git a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.Playing.cs.uid b/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.Playing.cs.uid deleted file mode 100644 index 4a81fdf9..00000000 --- a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.Playing.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://i54nvesmcliy diff --git a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.Quit.cs.uid b/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.Quit.cs.uid deleted file mode 100644 index c25f315e..00000000 --- a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.Quit.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://cq37bi3y07rxa diff --git a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.Resuming.cs.uid b/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.Resuming.cs.uid deleted file mode 100644 index cf152655..00000000 --- a/Zennysoft.Game.Ma.Implementation/Game/state/states/GameLogic.State.Resuming.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://clh8ucurjwuvh diff --git a/Zennysoft.Game.Ma/src/game/Game.cs b/Zennysoft.Game.Ma/src/game/Game.cs index bb2782a9..b8c3818e 100644 --- a/Zennysoft.Game.Ma/src/game/Game.cs +++ b/Zennysoft.Game.Ma/src/game/Game.cs @@ -80,6 +80,8 @@ public partial class Game : Node3D, IGame private EffectService _effectService; + private double _expRate = 1; + public void Setup() { _container = new SimpleInjector.Container(); @@ -371,7 +373,7 @@ public partial class Game : Node3D, IGame public void EnemyDefeated(Vector3 defeatedLocation, EnemyStatResource resource) { - Player.GainExp(resource.ExpFromDefeat * GameRepo.EXPRate); + Player.GainExp(resource.ExpFromDefeat * _expRate); } private void DropRestorative(Vector3 vector) @@ -444,13 +446,13 @@ public partial class Game : Node3D, IGame ToggleInventory(); AnnounceMessageOnMainScreen("Experience points temporarily doubled."); DoubleEXPTimer.Start(lengthOfEffect.Seconds); - GameRepo.EXPRate = 2; + _expRate = 2; } private void DoubleEXPTimer_Timeout() { DoubleEXPTimer.Stop(); - GameRepo.EXPRate = 1; + _expRate = 1; AnnounceMessageOnMainScreen("Experience points effect wore off."); } diff --git a/Zennysoft.Game.Ma/src/inventory_menu/InventoryMenu.cs b/Zennysoft.Game.Ma/src/inventory_menu/InventoryMenu.cs index 50e516d1..8724de2a 100644 --- a/Zennysoft.Game.Ma/src/inventory_menu/InventoryMenu.cs +++ b/Zennysoft.Game.Ma/src/inventory_menu/InventoryMenu.cs @@ -133,7 +133,7 @@ public partial class InventoryMenu : Control, IInventoryMenu private void ExpToNextLevel_Sync(int obj) => EXPValue.Text = $"{Player.Stats.CurrentExp.Value}/{obj}"; // TODO: Change font style when EXP Bonus effect is active - private void CurrentExp_Sync(int obj) => EXPValue.Text = $"{obj}/{Player.Stats.ExpToNextLevel.Value}"; + private void CurrentExp_Sync(double obj) => EXPValue.Text = $"{obj}/{Player.Stats.ExpToNextLevel.Value}"; private void MaxDefense_Sync(int obj) => DEFValue.Text = $"{Player.Stats.CurrentDefense.Value}/{obj}"; @@ -246,7 +246,8 @@ public partial class InventoryMenu : Control, IInventoryMenu private void PopulatePlayerInfo() { - FloorLabel.Text = $"Floor {_gameRepo.CurrentFloor:D2}"; + // TODO: Fix + FloorLabel.Text = $"Floor 01"; if (ItemSlots.Any()) { diff --git a/Zennysoft.Game.Ma/src/player/IPlayer.cs b/Zennysoft.Game.Ma/src/player/IPlayer.cs index 070d33b9..494c982c 100644 --- a/Zennysoft.Game.Ma/src/player/IPlayer.cs +++ b/Zennysoft.Game.Ma/src/player/IPlayer.cs @@ -20,7 +20,7 @@ public interface IPlayer : IKillable, IProvide> public void Knockback(float impulse); - public void GainExp(int expGained); + public void GainExp(double expGained); public void LevelUp(); diff --git a/Zennysoft.Game.Ma/src/player/Player.cs b/Zennysoft.Game.Ma/src/player/Player.cs index b3af71ae..2afc5d19 100644 --- a/Zennysoft.Game.Ma/src/player/Player.cs +++ b/Zennysoft.Game.Ma/src/player/Player.cs @@ -380,7 +380,7 @@ public partial class Player : CharacterBody3D, IPlayer _knockbackDirection = GlobalBasis.Z.Normalized(); } - public void GainExp(int expGained) + public void GainExp(double expGained) { Stats.SetCurrentExp(Stats.CurrentExp.Value + expGained); } @@ -571,7 +571,7 @@ public partial class Player : CharacterBody3D, IPlayer Die(); } - private void CurrentEXP_Sync(int newExp) + private void CurrentEXP_Sync(double newExp) { if (Stats.CurrentExp.Value >= Stats.ExpToNextLevel.Value) LevelUp(); diff --git a/Zennysoft.Game.Ma/src/player/PlayerStats.cs b/Zennysoft.Game.Ma/src/player/PlayerStats.cs index 57c400b9..359b752b 100644 --- a/Zennysoft.Game.Ma/src/player/PlayerStats.cs +++ b/Zennysoft.Game.Ma/src/player/PlayerStats.cs @@ -17,7 +17,7 @@ public partial record PlayerStats [Save("maximumVT")] public int MaximumVT { get; init; } [Save("currentExp")] - public int CurrentExp { get; init; } + public double CurrentExp { get; init; } [Save("currentLevel")] public int CurrentLevel { get; init; } [Save("currentAttack")] @@ -68,7 +68,7 @@ public class PlayerStatController public IAutoProp CurrentDefense => _currentDefense; public IAutoProp MaxDefense => _maxDefense; public IAutoProp BonusDefense => _bonusDefense; - public IAutoProp CurrentExp => _currentExp; + public IAutoProp CurrentExp => _currentExp; public IAutoProp ExpToNextLevel => _expToNextLevel; public IAutoProp CurrentLevel => _currentLevel; public IAutoProp Luck => _luck; @@ -91,7 +91,7 @@ public class PlayerStatController { _maximumVT.OnNext(newValue); } - public void SetCurrentExp(int newValue) + public void SetCurrentExp(double newValue) { _currentExp.OnNext(newValue); } @@ -139,7 +139,7 @@ public class PlayerStatController private readonly AutoProp _maximumHP = new(-1); private readonly AutoProp _currentVT = new(-1); private readonly AutoProp _maximumVT = new(-1); - private readonly AutoProp _currentExp = new(-1); + private readonly AutoProp _currentExp = new(-1); private readonly AutoProp _currentLevel = new(-1); private readonly AutoProp _currentAttack = new(-1); private readonly AutoProp _bonusAttack = new(-1);