Clean up
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
using Chickensoft.Collections;
|
using Chickensoft.Collections;
|
||||||
using Godot;
|
using Godot;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Zennysoft.Game.Ma.Implementation;
|
namespace Zennysoft.Game.Ma.Implementation;
|
||||||
|
|
||||||
@@ -11,38 +10,22 @@ public interface IGameRepo : IDisposable
|
|||||||
void Resume();
|
void Resume();
|
||||||
|
|
||||||
IAutoProp<bool> IsPaused { get; }
|
IAutoProp<bool> 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 class GameRepo : IGameRepo
|
||||||
{
|
{
|
||||||
public event Action? Ended;
|
public event Action? Ended;
|
||||||
|
|
||||||
public IAutoProp<Transform3D> PlayerGlobalTransform => _playerGlobalTransform;
|
|
||||||
private readonly AutoProp<Transform3D> _playerGlobalTransform;
|
|
||||||
|
|
||||||
public IAutoProp<bool> IsPaused => _isPaused;
|
public IAutoProp<bool> IsPaused => _isPaused;
|
||||||
private readonly AutoProp<bool> _isPaused;
|
private readonly AutoProp<bool> _isPaused;
|
||||||
|
|
||||||
public int MaxItemSize => 20;
|
public int MaxItemSize => 20;
|
||||||
|
|
||||||
public int EXPRate { get; set; } = 1;
|
|
||||||
|
|
||||||
private bool _disposedValue;
|
private bool _disposedValue;
|
||||||
|
|
||||||
public int CurrentFloor { get; set; } = 0;
|
|
||||||
|
|
||||||
public GameRepo()
|
public GameRepo()
|
||||||
{
|
{
|
||||||
_isPaused = new AutoProp<bool>(true);
|
_isPaused = new AutoProp<bool>(true);
|
||||||
_playerGlobalTransform = new AutoProp<Transform3D>(Transform3D.Identity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Pause()
|
public void Pause()
|
||||||
@@ -57,8 +40,6 @@ public class GameRepo : IGameRepo
|
|||||||
GD.Print("Resume");
|
GD.Print("Resume");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPlayerGlobalTransform(Transform3D playerGlobalTransform) => _playerGlobalTransform.OnNext(playerGlobalTransform);
|
|
||||||
|
|
||||||
public void OnGameEnded()
|
public void OnGameEnded()
|
||||||
{
|
{
|
||||||
Pause();
|
Pause();
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
uid://boai3f4vwgree
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://dw1wcux7lcpqy
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://cpu75lmblmbj4
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://dmbireek8b68t
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://lwjsht36v6ut
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://nlpm8t4dege2
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://c46publoqhqsn
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://i54nvesmcliy
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://cq37bi3y07rxa
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://clh8ucurjwuvh
|
|
||||||
@@ -80,6 +80,8 @@ public partial class Game : Node3D, IGame
|
|||||||
|
|
||||||
private EffectService _effectService;
|
private EffectService _effectService;
|
||||||
|
|
||||||
|
private double _expRate = 1;
|
||||||
|
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_container = new SimpleInjector.Container();
|
_container = new SimpleInjector.Container();
|
||||||
@@ -371,7 +373,7 @@ public partial class Game : Node3D, IGame
|
|||||||
|
|
||||||
public void EnemyDefeated(Vector3 defeatedLocation, EnemyStatResource resource)
|
public void EnemyDefeated(Vector3 defeatedLocation, EnemyStatResource resource)
|
||||||
{
|
{
|
||||||
Player.GainExp(resource.ExpFromDefeat * GameRepo.EXPRate);
|
Player.GainExp(resource.ExpFromDefeat * _expRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DropRestorative(Vector3 vector)
|
private void DropRestorative(Vector3 vector)
|
||||||
@@ -444,13 +446,13 @@ public partial class Game : Node3D, IGame
|
|||||||
ToggleInventory();
|
ToggleInventory();
|
||||||
AnnounceMessageOnMainScreen("Experience points temporarily doubled.");
|
AnnounceMessageOnMainScreen("Experience points temporarily doubled.");
|
||||||
DoubleEXPTimer.Start(lengthOfEffect.Seconds);
|
DoubleEXPTimer.Start(lengthOfEffect.Seconds);
|
||||||
GameRepo.EXPRate = 2;
|
_expRate = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoubleEXPTimer_Timeout()
|
private void DoubleEXPTimer_Timeout()
|
||||||
{
|
{
|
||||||
DoubleEXPTimer.Stop();
|
DoubleEXPTimer.Stop();
|
||||||
GameRepo.EXPRate = 1;
|
_expRate = 1;
|
||||||
AnnounceMessageOnMainScreen("Experience points effect wore off.");
|
AnnounceMessageOnMainScreen("Experience points effect wore off.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
|||||||
private void ExpToNextLevel_Sync(int obj) => EXPValue.Text = $"{Player.Stats.CurrentExp.Value}/{obj}";
|
private void ExpToNextLevel_Sync(int obj) => EXPValue.Text = $"{Player.Stats.CurrentExp.Value}/{obj}";
|
||||||
|
|
||||||
// TODO: Change font style when EXP Bonus effect is active
|
// 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}";
|
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()
|
private void PopulatePlayerInfo()
|
||||||
{
|
{
|
||||||
FloorLabel.Text = $"Floor {_gameRepo.CurrentFloor:D2}";
|
// TODO: Fix
|
||||||
|
FloorLabel.Text = $"Floor 01";
|
||||||
|
|
||||||
if (ItemSlots.Any())
|
if (ItemSlots.Any())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public interface IPlayer : IKillable, IProvide<ISaveChunk<PlayerData>>
|
|||||||
|
|
||||||
public void Knockback(float impulse);
|
public void Knockback(float impulse);
|
||||||
|
|
||||||
public void GainExp(int expGained);
|
public void GainExp(double expGained);
|
||||||
|
|
||||||
public void LevelUp();
|
public void LevelUp();
|
||||||
|
|
||||||
|
|||||||
@@ -380,7 +380,7 @@ public partial class Player : CharacterBody3D, IPlayer
|
|||||||
_knockbackDirection = GlobalBasis.Z.Normalized();
|
_knockbackDirection = GlobalBasis.Z.Normalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GainExp(int expGained)
|
public void GainExp(double expGained)
|
||||||
{
|
{
|
||||||
Stats.SetCurrentExp(Stats.CurrentExp.Value + expGained);
|
Stats.SetCurrentExp(Stats.CurrentExp.Value + expGained);
|
||||||
}
|
}
|
||||||
@@ -571,7 +571,7 @@ public partial class Player : CharacterBody3D, IPlayer
|
|||||||
Die();
|
Die();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CurrentEXP_Sync(int newExp)
|
private void CurrentEXP_Sync(double newExp)
|
||||||
{
|
{
|
||||||
if (Stats.CurrentExp.Value >= Stats.ExpToNextLevel.Value)
|
if (Stats.CurrentExp.Value >= Stats.ExpToNextLevel.Value)
|
||||||
LevelUp();
|
LevelUp();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public partial record PlayerStats
|
|||||||
[Save("maximumVT")]
|
[Save("maximumVT")]
|
||||||
public int MaximumVT { get; init; }
|
public int MaximumVT { get; init; }
|
||||||
[Save("currentExp")]
|
[Save("currentExp")]
|
||||||
public int CurrentExp { get; init; }
|
public double CurrentExp { get; init; }
|
||||||
[Save("currentLevel")]
|
[Save("currentLevel")]
|
||||||
public int CurrentLevel { get; init; }
|
public int CurrentLevel { get; init; }
|
||||||
[Save("currentAttack")]
|
[Save("currentAttack")]
|
||||||
@@ -68,7 +68,7 @@ public class PlayerStatController
|
|||||||
public IAutoProp<int> CurrentDefense => _currentDefense;
|
public IAutoProp<int> CurrentDefense => _currentDefense;
|
||||||
public IAutoProp<int> MaxDefense => _maxDefense;
|
public IAutoProp<int> MaxDefense => _maxDefense;
|
||||||
public IAutoProp<int> BonusDefense => _bonusDefense;
|
public IAutoProp<int> BonusDefense => _bonusDefense;
|
||||||
public IAutoProp<int> CurrentExp => _currentExp;
|
public IAutoProp<double> CurrentExp => _currentExp;
|
||||||
public IAutoProp<int> ExpToNextLevel => _expToNextLevel;
|
public IAutoProp<int> ExpToNextLevel => _expToNextLevel;
|
||||||
public IAutoProp<int> CurrentLevel => _currentLevel;
|
public IAutoProp<int> CurrentLevel => _currentLevel;
|
||||||
public IAutoProp<double> Luck => _luck;
|
public IAutoProp<double> Luck => _luck;
|
||||||
@@ -91,7 +91,7 @@ public class PlayerStatController
|
|||||||
{
|
{
|
||||||
_maximumVT.OnNext(newValue);
|
_maximumVT.OnNext(newValue);
|
||||||
}
|
}
|
||||||
public void SetCurrentExp(int newValue)
|
public void SetCurrentExp(double newValue)
|
||||||
{
|
{
|
||||||
_currentExp.OnNext(newValue);
|
_currentExp.OnNext(newValue);
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@ public class PlayerStatController
|
|||||||
private readonly AutoProp<int> _maximumHP = new(-1);
|
private readonly AutoProp<int> _maximumHP = new(-1);
|
||||||
private readonly AutoProp<int> _currentVT = new(-1);
|
private readonly AutoProp<int> _currentVT = new(-1);
|
||||||
private readonly AutoProp<int> _maximumVT = new(-1);
|
private readonly AutoProp<int> _maximumVT = new(-1);
|
||||||
private readonly AutoProp<int> _currentExp = new(-1);
|
private readonly AutoProp<double> _currentExp = new(-1);
|
||||||
private readonly AutoProp<int> _currentLevel = new(-1);
|
private readonly AutoProp<int> _currentLevel = new(-1);
|
||||||
private readonly AutoProp<int> _currentAttack = new(-1);
|
private readonly AutoProp<int> _currentAttack = new(-1);
|
||||||
private readonly AutoProp<int> _bonusAttack = new(-1);
|
private readonly AutoProp<int> _bonusAttack = new(-1);
|
||||||
|
|||||||
Reference in New Issue
Block a user