[Refactor] Final fix GameManager & GameController
This commit is contained in:
@@ -6,7 +6,7 @@ using YachtDice.Scoring;
|
||||
|
||||
namespace YachtDice.Game
|
||||
{
|
||||
public class GameManager : MonoBehaviour
|
||||
public class GameLoopController : MonoBehaviour
|
||||
{
|
||||
[Header("Settings")]
|
||||
[SerializeField] private int maxRollsPerTurn = 3;
|
||||
@@ -47,7 +47,6 @@ namespace YachtDice.Game
|
||||
CurrentRoll = 0;
|
||||
_diceManager.UnlockAll();
|
||||
OnTurnStarted?.Invoke(CurrentTurn);
|
||||
Debug.Log($"=== Turn {CurrentTurn} ===");
|
||||
}
|
||||
|
||||
public void Roll()
|
||||
@@ -62,10 +61,6 @@ namespace YachtDice.Game
|
||||
private void HandleAllDiceSettled()
|
||||
{
|
||||
_diceManager.OnAllDiceSettled -= HandleAllDiceSettled;
|
||||
|
||||
var values = _diceManager.GetCurrentValues();
|
||||
Debug.Log($"Roll {CurrentRoll}/{maxRollsPerTurn} | Dice: [{string.Join(", ", values)}]");
|
||||
|
||||
OnRollComplete?.Invoke(CurrentRoll);
|
||||
}
|
||||
|
||||
@@ -74,9 +69,6 @@ namespace YachtDice.Game
|
||||
if (_diceManager.IsAnyRolling) return;
|
||||
if (CurrentRoll == 0) return;
|
||||
_diceManager.ToggleLock(index);
|
||||
|
||||
var isLocked = _diceManager.IsLocked(index);
|
||||
Debug.Log($"Dice {index + 1} (value={_diceManager.GetValue(index)}): {(isLocked ? "LOCKED" : "UNLOCKED")}");
|
||||
}
|
||||
|
||||
public void ScoreInCategory(CategoryDefinition category)
|
||||
@@ -85,18 +77,13 @@ namespace YachtDice.Game
|
||||
if (_scoringSystem.IsCategoryUsed(category)) return;
|
||||
|
||||
var dice = _diceManager.GetDice();
|
||||
ScoreResult result = _scoringSystem.ScoreCategory(dice, category);
|
||||
|
||||
Debug.Log($"Scored {category.DisplayName}: base={result.baseScore}, " +
|
||||
$"bonus=+{result.flatBonus}, mult=x{result.multiplier:F1}, " +
|
||||
$"FINAL={result.FinalScore} | Total={_scoringSystem.TotalScore}");
|
||||
var result = _scoringSystem.ScoreCategory(dice, category);
|
||||
|
||||
OnScored?.Invoke(category, result.FinalScore);
|
||||
|
||||
if (_scoringSystem.IsComplete)
|
||||
{
|
||||
var total = _scoringSystem.TotalScore;
|
||||
Debug.Log($"*** GAME OVER *** Total Score: {total}");
|
||||
OnGameOver?.Invoke(total);
|
||||
}
|
||||
else
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 187be5e60b9cc014fbe755fbe18578be
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 187be5e60b9cc014fbe755fbe18578be
|
||||
Reference in New Issue
Block a user