refactor: enhance GameStateStore integration and improve skill management
This commit is contained in:
16
scripts/State/GhostSaveData.cs
Normal file
16
scripts/State/GhostSaveData.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Mr.BrickAdventures.scripts.State;
|
||||
|
||||
public class GhostSaveData
|
||||
{
|
||||
public double BestTime { get; set; }
|
||||
public List<GhostFrameDto> Frames { get; set; } = new();
|
||||
}
|
||||
|
||||
public class GhostFrameDto
|
||||
{
|
||||
public double Timestamp { get; set; }
|
||||
public float X { get; set; }
|
||||
public float Y { get; set; }
|
||||
}
|
||||
1
scripts/State/GhostSaveData.cs.uid
Normal file
1
scripts/State/GhostSaveData.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://drp68lkok8if3
|
||||
@@ -11,6 +11,11 @@ public class PlayerState
|
||||
{
|
||||
private const int DefaultLives = 3;
|
||||
|
||||
/// <summary>
|
||||
/// The level index the player is currently on. Persisted across sessions.
|
||||
/// </summary>
|
||||
public int CurrentLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Saved coins (not including current session).
|
||||
/// </summary>
|
||||
@@ -56,6 +61,7 @@ public class PlayerState
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
CurrentLevel = 0;
|
||||
Coins = 0;
|
||||
Lives = DefaultLives;
|
||||
CompletedLevels.Clear();
|
||||
|
||||
@@ -9,11 +9,6 @@ namespace Mr.BrickAdventures.scripts.State;
|
||||
/// </summary>
|
||||
public class SessionState
|
||||
{
|
||||
/// <summary>
|
||||
/// Current level index being played.
|
||||
/// </summary>
|
||||
public int CurrentLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Coins collected during this session (not yet saved).
|
||||
/// </summary>
|
||||
@@ -29,7 +24,6 @@ public class SessionState
|
||||
/// </summary>
|
||||
public static SessionState CreateDefault() => new()
|
||||
{
|
||||
CurrentLevel = 0,
|
||||
CoinsCollected = 0,
|
||||
SkillsUnlocked = new List<SkillData>()
|
||||
};
|
||||
@@ -44,11 +38,10 @@ public class SessionState
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets completely including level.
|
||||
/// Resets all session state.
|
||||
/// </summary>
|
||||
public void ResetAll()
|
||||
{
|
||||
CurrentLevel = 0;
|
||||
CoinsCollected = 0;
|
||||
SkillsUnlocked.Clear();
|
||||
}
|
||||
|
||||
10
scripts/State/StatNames.cs
Normal file
10
scripts/State/StatNames.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Mr.BrickAdventures.scripts.State;
|
||||
|
||||
public static class StatNames
|
||||
{
|
||||
public const string CoinsCollected = "coins_collected";
|
||||
public const string EnemiesDefeated = "enemies_defeated";
|
||||
public const string Deaths = "deaths";
|
||||
public const string LevelsCompleted = "levels_completed";
|
||||
public const string ChildrenRescued = "children_rescued";
|
||||
}
|
||||
1
scripts/State/StatNames.cs.uid
Normal file
1
scripts/State/StatNames.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dtqjh4v5w41ni
|
||||
Reference in New Issue
Block a user