public void BeginCampaign(string balanceName) { gameBalance = Resources.Load <GameBalance>(balanceName); Debug.Assert(gameBalance != null); playerStats = gameObject.AddComponent <VesselStats>(); playerStats.SetStats(new VesselStatValues()); playerStatus = gameObject.AddComponent <VesselStatus>(); //playerStatus.InitialiseFull(gameBalance, playerStats); encounter = null; state = State.None; nextEncounter = 0; state = State.InitialStats; int remainingPoints = gameBalance.initialStatPoints; while (remainingPoints > 0) { int statCount = System.Enum.GetValues(typeof(VesselStats.Type)).Length; for (int i = 0; remainingPoints > 0 && i < statCount; ++i) { playerStats.SetRaw((VesselStats.Type)i, playerStats.GetRaw((VesselStats.Type)i) + 1); --remainingPoints; } } Game.Instance.pageManager.SetPage("InitialStats"); }
public void TryDec(VesselStats.Type stat) { Campaign campaign = Game.Instance.campaign; VesselStats stats = campaign.playerStats; if (stats.GetRaw(stat) <= 0) { Game.Instance.audioManager.Play("failure"); return; } stats.SetRaw(stat, stats.GetRaw(stat) - 1); UpdateDisplay(); Game.Instance.audioManager.Play("success"); }
public void TryInc(VesselStats.Type stat) { Campaign campaign = Game.Instance.campaign; VesselStats stats = campaign.playerStats; if (GetRemaining() <= 0 || stats.GetRaw(stat) >= VesselStats.MaxStatValue) { Game.Instance.audioManager.Play("failure"); return; } stats.SetRaw(stat, stats.GetRaw(stat) + 1); UpdateDisplay(); Game.Instance.audioManager.Play("success"); }
public void TryInc(VesselStats.Type stat) { Campaign campaign = Game.Instance.campaign; VesselStats stats = campaign.playerStats; if (stats.GetRaw(stat) >= VesselStats.MaxStatValue) { Game.Instance.audioManager.Play("failure"); return; } stats.SetRaw(stat, stats.GetRaw(stat) + 1); Game.Instance.audioManager.Play("success"); pageManager.PopPage(); onPointSpent?.Invoke(); }