public void UpgradeGem() { if (comboable && gemScript.UpgradedPrefab != null) { Debug.Log(this.transform.position + " upgraded gem"); gemScript.DestroyGem(); Gem = gemScript.SpawnGemCopy(this.transform, gemScript.UpgradedPrefab); gemScript.SetGemProperties(this.transform.position, gem); } }
//Button Action void ChangeSquareGem() { GameObject newGem = (GameObject)GetGemPoolObjects()[selection]; GameObject newBaseGem = (GameObject)GetGemPoolObjects()[selection]; baseGem newGemScript = newGem.GetComponent <baseGem>(); square.GemScript.DestroyGem(false); newGemScript.SetGemProperties(square.transform.position, newGem, square.transform); square.Gem = newGemScript.SpawnGemCopy(square.transform, newGemScript.GemGO, newBaseGem); square.gemPrefab = newGemScript.GemGO; }
public void UpgradeGem() { if (gemScript.UpgradedPrefab != null) { StartCoroutine(gemScript.DestroyGem(true)); if (gemScript.basePrefab == null) { Debug.Log("Base Prefab Null"); } if (gemScript.UpgradedPrefab == null) { Debug.Log("Upgraded Prefab Null"); } Gem = gemScript.SpawnGemCopy(this.transform, gemScript.UpgradedPrefab, gemScript.basePrefab); if (Gem) { gemScript.SetGemProperties(this.transform.position, gem, this.transform); } } }