private void UpdateDisplay() { Campaign campaign = Game.Instance.campaign; VesselStats stats = campaign.playerStats; textAttack.Text = stats.GetRaw(VesselStats.Type.Attack).ToString(); textDefense.Text = stats.GetRaw(VesselStats.Type.Defense).ToString(); textLuck.Text = stats.GetRaw(VesselStats.Type.Luck).ToString(); }
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 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 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(); }
public void ApplyHullDamage(int amount, bool allowSystemsDamage) { if (amount < 0) { return; } var damage = Mathf.RoundToInt(amount * (1f - (stats.GetRaw(VesselStats.Type.Defense) / (float)VesselStats.MaxStatValue) * 0.5f)); health = Mathf.Max(health - damage, 0); Debug.LogFormat("> hull took {0} (Pre defense damage of {1})", damage, amount); if (damage > 0 && allowSystemsDamage) { ApplySystemsDamage(damage); } }