Example #1
0
    public void SkinUnlockOrEquip(int catNumber, int skinNumber)
    {
        playerDetails = gameDataObject.GetComponent <PlayerDetailsScript>();
        playerInv     = gameDataObject.GetComponent <PlayerInventoryScript>();
        playerStable  = gameDataObject.GetComponent <PlayerStableScript>();

        Debug.Log(playerInv.catSkins[skinNumber]);

        int skinStatus = playerInv.catsUnlocked[catNumber]; //Grab the status of the skin

        if (skinStatus == 1)                                //If we own it
        {
            playerStable.currentCat = catNumber;            //Equip it
            catSpawn.DeleteCat();
            catSpawn.SpawnOwnCat();
            //Code to refresh cat here
        }

        if (skinStatus == 0)
        {
            if (playerDetails.hardCurrency >= 500)       //If we can afford it
            {
                playerDetails.hardCurrency       -= 500; //Buy it
                playerInv.catsUnlocked[catNumber] = 1;   //Register it in inventory
                SkinUnlockOrEquip(catNumber, skinNumber);
            }
        }
    }
Example #2
0
 public void MoveAndSpawn()
 {
     catInstance = Instantiate(catSpawner, spawnLoc, Quaternion.identity) as GameObject;
     spawnLoc   += new Vector3(0.0f, 0.0f, 0.2f);
     catSpawnScript.SpawnOwnCat();
 }