public void Upgrade(Enums.Stats stat) { if (!IsMaxedOut(stat)) { data.UpgradeStat(stats[stat]); } }
// [gold, genes] public List <int> GetNextUpgradeCost(Enums.Stats stat) { int CurrentLevel = GetLevel(stat); // no cost if already at max if (IsMaxedOut(stat)) { return(new List <int>() { 0, 0 }); } Stats statData = stats[stat]; if (stat == Enums.Stats.Special) { statData = (SpecialStat)statData; } int GoldCost = statData.GetGold(CurrentLevel + 1); int GeneCost = statData.GetGenes(CurrentLevel + 1); return(new List <int> { GoldCost, GeneCost }); }
public double GetStat(Enums.Stats stat) { if (stat == Enums.Stats.Special) { GD.PushError("Use GetSpecial() to get the info on a dino special!"); GD.PrintStack(); throw new InvalidOperationException("Use GetSpecial() to get the info on a dino special!"); } return(stats[stat].GetStat()); }
public override void _Process(float delta) { ShopUpgradeButton parentButton = GetNodeOrNull <ShopUpgradeButton>(parentNode); if (parentButton == null) { return; } if (parentButton.infoSet) { buttonMode = parentButton.statButtonMode; SetUpgradeCost(); } SetProcess(false); }
/////////////////////////// // Misc utlity functions // /////////////////////////// public int GetMaxLevel(Enums.Stats stat) { if (stat == Enums.Stats.Special) { if (HasSpecial()) { return(1); } else { return(0); } } else { // our level is 0-indexed but count is not, so decrement one return(stats[stat].stats.Count - 1); } }
public int GetGeneCost(Enums.Stats stat) { return(stats[stat].GetGenes()); }
public int GetGoldCost(Enums.Stats stat) { return(stats[stat].GetGold()); }
public int GetLevel(Enums.Stats stat) { return(stats[stat].level); }
public bool IsMaxedOut(Enums.Stats stat) { return(GetLevel(stat) >= GetMaxLevel(stat)); }
public virtual void SetButtonInfo() { switch (exportedButtonMode) { case b.Dmg: name.Text = "Damage"; stat.Text = "DPS"; image.Texture = GD.Load <Texture>("res://assets/abilities/fire.png"); statButtonMode = Enums.Stats.Dmg; break; case b.Def: name.Text = "Defense"; stat.Text = "x"; image.Texture = GD.Load <Texture>("res://assets/abilities/health.png"); statButtonMode = Enums.Stats.Def; break; case b.Speed: name.Text = "Speed"; stat.Text = "KM/h"; image.Texture = GD.Load <Texture>("res://assets/abilities/speed.png"); statButtonMode = Enums.Stats.Speed; break; case b.Special: statButtonMode = Enums.Stats.Special; if (!dinoInfo.HasSpecial()) { Hide(); break; } name.Text = "Special"; stat.Text = ""; statNum.Text = ""; // get the current special ability type using the info about the current dino screen we're on (shopinfo.shopdino) // then get the icon using that special ability type var ability = DinoInfo.Instance.dinoTypesAndAbilities[ShopInfo.shopDino]; image.Texture = DinoInfo.Instance.specialAbilityIcons[ability]; break; } infoSet = true; if (statButtonMode == Enums.Stats.Special) { statNum.Text = dinoInfo.GetSpecial(); } else { statNum.Text = dinoInfo.GetStat(statButtonMode).ToString(); } List <int> cost = dinoInfo.GetNextUpgradeCost(statButtonMode); goldCost = cost[0]; geneCost = cost[1]; }