예제 #1
0
    void WearSkin(ShopKeeper.Skin skin)
    {
        PlayerPrefs.SetString("player_skin", skin.address);
        skinName.text = skin.name;

        sr.color = skin.bodyColor;

        for (int i = 0; i < 3; i++)
        {
            transform.GetChild(i).localPosition = (Vector3)(new Vector2(i - 0.5F, 0F) * 0.5F + skin.eyeOffs);
            transform.GetChild(i).gameObject.GetComponent <SpriteRenderer>().color = skin.eyeColor;
        }

        for (int i = 0; i < 3; i++)
        {
            SpriteRenderer childSr = transform.GetChild(i + 2).gameObject.GetComponent <SpriteRenderer>();

            ShopKeeper.Accessory acc;
            try {
                acc = skin.accessories[i];
            } catch {
                acc = new ShopKeeper.Accessory();
            }

            transform.GetChild(i + 2).localPosition = acc.relPos;
            transform.GetChild(i + 2).localScale    = acc.scale;
            childSr.sprite = acc.sprite;
            childSr.color  = acc.color;
        }
        ;

        if (skin.name == "GOD")
        {
            sr.sprite     = circleSprite;
            eyeSr1.sprite = circleSprite;
            eyeSr2.sprite = circleSprite;
            circle        = true;
            return;
        }
        else
        {
            sr.sprite     = squareSprite;
            eyeSr2.sprite = squareSprite;
            eyeSr1.sprite = squareSprite;
            circle        = false;
        }

        blur.SendMessage("SetBlurColor", skin.blurColor);
    }
예제 #2
0
 void TapToBuy(int i)
 {
     ShopKeeper.Skin skin = sk.inventory[i];
     if (sc.count >= skin.cost)
     {
         sc.SendMessage("CoinGet", -skin.cost);
         skin.unlocked = true;
         PlayerPrefs.SetInt(skin.address, 1);
         gm.SendMessage("SaveMoney");
         price.SetActive(false);
         player.SendMessage("WearSkin", skin);
         sk.SendMessage("PlaySound", "kaching");
     }
     else
     {
         sk.SendMessage("PlaySound", "booboo");
     }
 }
예제 #3
0
 void SetPreview(ShopKeeper.Skin skin)
 {
     this.skin = skin;
     UpdateSkin();
 }