private void SpawnGem(int lootChance, GemScript.GemType gemType, Vector3 frogPosition) { var rand = UnityEngine.Random.Range(0, 101); if (rand < lootChance) { var spawnedGem = Instantiate(gemPrefab, frogPosition + Random.insideUnitSphere * 200, Quaternion.identity); spawnedGem.transform.SetParent(GameObject.Find("Game").transform); spawnedGem.GetComponent <GemScript>().SetType(gemType); this.gems.Add(spawnedGem); } }
public void SpendGems(int amount, GemScript.GemType gemType) { if (gemType == GemScript.GemType.tier1Gem) { tier1GemCount -= amount; } if (gemType == GemScript.GemType.tier2Gem) { tier2GemCount -= amount; } if (gemType == GemScript.GemType.tier3Gem) { tier3GemCount -= amount; } Save(null); }
public void IncreaseGemAmount(int amount, GemScript.GemType gemType) { if (gemType == GemScript.GemType.tier1Gem) { tier1GemCount += amount; } if (gemType == GemScript.GemType.tier2Gem) { tier2GemCount += amount; } if (gemType == GemScript.GemType.tier3Gem) { tier3GemCount += amount; } Save(null); }
public int getCurrentGemsNumber(GemScript.GemType gemType) { switch (gemType) { case GemScript.GemType.Normal: return(currentNormalGemsNumber); case GemScript.GemType.Rare: return(currentRareGemsNumber); case GemScript.GemType.Epic: return(currentEpicGemsNumber); case GemScript.GemType.Legendary: return(currentLegendaryGemsNumber); default: return(0); } }
void OnCurrentGemsNumberChange(int number, GemScript.GemType type) { switch (type) { case GemScript.GemType.Normal: normalGemsCountText.text = number.ToString(); break; case GemScript.GemType.Rare: rareGemsCountText.text = number.ToString(); break; case GemScript.GemType.Epic: epicGemsCountText.text = number.ToString(); break; case GemScript.GemType.Legendary: legendaryGemsCountText.text = number.ToString(); break; } }
public void SubtractFromCurrentGemsNumber(int amount, GemScript.GemType type) { switch (type) { case GemScript.GemType.Normal: currentNormalGemsNumber -= amount; if (OnCurrentGemsNumberChange != null) { OnCurrentGemsNumberChange(currentNormalGemsNumber, type); } break; case GemScript.GemType.Rare: currentRareGemsNumber -= amount; if (OnCurrentGemsNumberChange != null) { OnCurrentGemsNumberChange(currentRareGemsNumber, type); } break; case GemScript.GemType.Epic: currentEpicGemsNumber -= amount; if (OnCurrentGemsNumberChange != null) { OnCurrentGemsNumberChange(currentEpicGemsNumber, type); } break; case GemScript.GemType.Legendary: currentLegendaryGemsNumber -= amount; if (OnCurrentGemsNumberChange != null) { OnCurrentGemsNumberChange(currentLegendaryGemsNumber, type); } break; } }
public void IncrementCurrentGemsNumber(GemScript.GemType type) { switch (type) { case GemScript.GemType.Normal: currentNormalGemsNumber++; if (OnCurrentGemsNumberChange != null) { OnCurrentGemsNumberChange(currentNormalGemsNumber, type); } break; case GemScript.GemType.Rare: currentRareGemsNumber++; if (OnCurrentGemsNumberChange != null) { OnCurrentGemsNumberChange(currentRareGemsNumber, type); } break; case GemScript.GemType.Epic: currentEpicGemsNumber++; if (OnCurrentGemsNumberChange != null) { OnCurrentGemsNumberChange(currentEpicGemsNumber, type); } break; case GemScript.GemType.Legendary: currentLegendaryGemsNumber++; if (OnCurrentGemsNumberChange != null) { OnCurrentGemsNumberChange(currentLegendaryGemsNumber, type); } break; } }