Beispiel #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.catRoomItems[catNumber]; //Grab the status of the skin

        if (skinStatus == 1)                                //If we own it
        {
            playerStable.currentRoom = catNumber + 1;       //Equip it

            roomSpawn.SpawnRoom();
            //Code to refresh cat here
        }

        if (skinStatus == 0)
        {
            if (playerDetails.hardCurrency >= 1000)       //If we can afford it
            {
                playerDetails.hardCurrency       -= 1000; //Buy it
                playerInv.catRoomItems[catNumber] = 1;    //Register it in inventory
                SkinUnlockOrEquip(catNumber, skinNumber);
            }
        }
    }