1+ using BaldersGait . Core . Consts ;
2+ using BaldersGait . Core . Models . SavedState ;
3+
4+ namespace BaldersGait . Core . Models . CalculatedState ;
5+
6+ /// <summary>
7+ /// Game state thats calculated at runtime, nothing in here is saved
8+ /// </summary>
9+ public sealed class CalculatedGameState
10+ {
11+ /// <summary>
12+ /// ctor
13+ /// </summary>
14+ /// <param name="savedGameState"></param>
15+ public CalculatedGameState ( SavedGameState savedGameState )
16+ {
17+ Update ( savedGameState ) ;
18+ }
19+
20+ /// <summary>
21+ /// The base hair per tick before chair scaling modifiers
22+ /// </summary>
23+ public double BaseHairPerTick { get ; private set ; }
24+
25+ /// <summary>
26+ /// Should money be visible in the UI?
27+ /// </summary>
28+ public bool IsMoneyVisible { get ; private set ; }
29+
30+ /// <summary>
31+ /// Should the wig shop button be visible in the UI?
32+ /// </summary>
33+ public bool IsWigShopButtonVisible { get ; private set ; }
34+
35+ /// <summary>
36+ /// Are the hair growth V1 upgrades maxed out?
37+ /// </summary>
38+ public bool IsHairGrowthV1UpgradesMaxed { get ; private set ; }
39+
40+ /// <summary>
41+ /// Are the scaling factor V1 upgrades maxed out?
42+ /// </summary>
43+ public bool IsScalingFactorV1UpgradesMaxed { get ; private set ; }
44+
45+ /// <summary>
46+ /// Are the max hair V1 upgrades maxed out?
47+ /// </summary>
48+ public bool IsMaxHairV1UpgradesMaxed { get ; private set ; }
49+
50+ /// <summary>
51+ /// Updates the calculated state with the current saved game state
52+ /// </summary>
53+ /// <param name="savedGameState"></param>
54+ public void Update ( SavedGameState savedGameState )
55+ {
56+ BaseHairPerTick = Math . Round ( 0.01 * ( savedGameState . HairGrowthV1Upgrades + 1 ) , 3 ) ; ;
57+ IsMoneyVisible = savedGameState . CompanyPurchased ;
58+ IsWigShopButtonVisible = savedGameState . CompanyPurchased ;
59+ IsHairGrowthV1UpgradesMaxed = savedGameState . HairGrowthV1Upgrades >= GameStateConsts . HairGrowthV1UpgradesMax ;
60+ IsScalingFactorV1UpgradesMaxed = savedGameState . ScalingFactorV1Upgrades >= GameStateConsts . ScalingFactorV1UpgradesMax ;
61+ IsMaxHairV1UpgradesMaxed = savedGameState . MaxHairV1Upgrades >= GameStateConsts . MaxHairV1UpgradesMax ;
62+ }
63+ }
0 commit comments