Ejemplo n.º 1
0
    public void BuyDecoration(int i)
    {
        ShopBatiments bat = ShopBatiments.NONE;

        switch (i)
        {
        case 0:
            bat = ShopBatiments.CHEST;
            break;

        case 1:
            bat = ShopBatiments.BRIDGE;
            break;

        case 2:
            bat = ShopBatiments.FISHDRYER;
            break;

        default:
            break;
        }

        if (BuyItems(decorationItems[i], bat))
        {
            UpdateDecorationImage(bat);
        }
    }
Ejemplo n.º 2
0
    public void BuyIgloo(int i)
    {
        ShopBatiments bat = ShopBatiments.NONE;

        switch (i)
        {
        case 0:
            bat = ShopBatiments.IGLOO1;
            break;

        case 1:
            bat = ShopBatiments.IGLOO2;
            break;

        case 2:
            bat = ShopBatiments.IGLOO3;
            break;

        default:
            break;
        }

        if (BuyItems(iglooItems[i], bat))
        {
            UpdateIglooButtonImage();
        }
    }
Ejemplo n.º 3
0
    void UpdateDecorationImage(ShopBatiments type)
    {
        int it = 0;

        switch (type)
        {
        case ShopBatiments.CHEST:
            it = 0;
            break;

        case ShopBatiments.FISHDRYER:
            it = 2;
            break;

        case ShopBatiments.BRIDGE:
            it = 1;
            break;

        default:
            break;
        }

        int    level = decorationItems[it].Level;
        Button bt    = decorationButtons[it];

        if (level < 10)
        {
            bt.image.sprite = decorationItems[it].LevelSprite[0];
        }
        if (level >= 10 && level < 20)
        {
            bt.image.sprite = decorationItems[it].LevelSprite[1];
        }
        if (level >= 20)
        {
            bt.image.sprite = decorationItems[it].LevelSprite[2];
        }
    }
Ejemplo n.º 4
0
    private bool BuyItems(ShopItems item, ShopBatiments bat)
    {
        if (game.GetHearts < item.Cost || bat == ShopBatiments.NONE)
        {
            Source.PlayOneShot(CantBuySound);
            return(false);
        }

        Source.PlayOneShot(BuySound);
        game.GetHearts -= item.Cost;

        switch (item.Level)
        {
        case 0:
            // Generate
            switch (bat)
            {
            case ShopBatiments.IGLOO1:
                game.GenerateIgloo1(0);
                break;

            case ShopBatiments.IGLOO2:
                game.GenerateIgloo1(1);
                break;

            case ShopBatiments.IGLOO3:
                game.GenerateIgloo1(2);
                break;

            case ShopBatiments.CHEST:
                game.GenerateChest();
                break;

            case ShopBatiments.FISHDRYER:
                game.GenerateSechoir();
                break;
            }
            //Faire pop
            break;

        case 4:
            switch (bat)
            {
            case ShopBatiments.CHEST:
                game.GenerateChest();
                break;

            case ShopBatiments.FISHDRYER:
                game.GenerateSechoir();
                break;
            }
            break;

        case 9:
            //Upgrade 1
            switch (bat)
            {
            case ShopBatiments.IGLOO1:
                game.GenerateIgloo2(0);
                break;

            case ShopBatiments.IGLOO2:
                game.GenerateIgloo2(1);
                break;

            case ShopBatiments.IGLOO3:
                game.GenerateIgloo2(2);
                break;

            case ShopBatiments.CHEST:
                game.chestLevel = 2;
                game.GenerateChest();
                break;

            case ShopBatiments.FISHDRYER:
                game.sechoirLevel = 2;
                game.GenerateSechoir();
                break;

            case ShopBatiments.BRIDGE:
                game.bridgeLevel = 2;
                game.GenerateBridge2();
                break;
            }

            break;

        case 14:
            switch (bat)
            {
            case ShopBatiments.CHEST:
                game.GenerateChest();
                break;

            case ShopBatiments.FISHDRYER:
                game.GenerateSechoir();
                break;
            }
            break;

        case 19:
            switch (bat)
            {
            case ShopBatiments.IGLOO1:
                game.GenerateIgloo3(0);
                break;

            case ShopBatiments.IGLOO2:
                game.GenerateIgloo3(1);
                break;

            case ShopBatiments.IGLOO3:
                game.GenerateIgloo3(2);
                break;

            case ShopBatiments.CHEST:
                game.chestLevel = 3;
                game.GenerateChest();
                break;

            case ShopBatiments.FISHDRYER:
                game.sechoirLevel = 3;
                game.GenerateSechoir();
                break;

            case ShopBatiments.BRIDGE:
                game.bridgeLevel = 3;
                game.GenerateBridge3();
                break;
            }
            //Upgrade 2
            break;

        default:
            break;
        }

        if (item.Level == 0)
        {
            game.GetHPS += item.Gain;
        }
        else
        {
            game.GetHPS -= item.Gain;
            game.GetHPS += (int)(item.Gain * item.GainMultiplier);
        }

        item.Level++;
        item.Gain = (int)(item.Gain * item.GainMultiplier);
        item.Cost = (int)(item.Cost * item.CostMultiplier);

        item.CostText.text = item.Cost.ToString();
        return(true);
    }