public void Skin2UnlockOrEquip() { cat1Details = gameOptionsObject.GetComponent <Cat1DetailsScript>(); if (!cat1Details.cat1SkinEquipped[1] && cat1Details.cat1SkinsUnlocked[1]) //If we own the skin and it's not equipped { //First set all skins to be unequipped for (int i = 0; i < cat1Details.cat1SkinEquipped.Length; i++) { cat1Details.cat1SkinEquipped[i] = false; } //Then Set the appropriate one to be equipped cat1Details.cat1SkinEquipped[1] = true; } if (!cat1Details.cat1SkinsUnlocked[1]) { gameOptions = gameOptionsObject.GetComponent <GameOptionsScript>(); if (gameOptions.playerSoftCash >= 500) { cat1Details.cat1SkinsUnlocked[1] = true; gameOptions.playerSoftCash -= 500; } } }
public void CatSkin() { gameOptionsObject = GameObject.FindGameObjectWithTag("GameOptions"); //Grab the object that contains the options data catOptions = gameOptionsObject.GetComponent <Cat1DetailsScript>(); //Grab the cat data catRend = theCat.GetComponent <Renderer>(); for (int i = 0; i < catOptions.cat1SkinEquipped.Length; i++) { if (catOptions.cat1SkinEquipped[i]) { catSkin = i; } } catRend.material.mainTexture = (catTextures[catSkin]); }