Exemple #1
0
    public static int GetBulletIndex(LevelPlayground.Bullets bullet)
    {
        int index = -1;

        switch (bullet)
        {
        case LevelPlayground.Bullets.Knife:
            index = 0;
            break;

        case LevelPlayground.Bullets.Pencil:
            index = 1;
            break;

        case LevelPlayground.Bullets.Sword:
            index = 2;
            break;

        case LevelPlayground.Bullets.Fork:
            index = 3;
            break;
        }

        return(index);
    }
Exemple #2
0
    public static Cells GetCellByBullet(LevelPlayground.Bullets bullet)
    {
        Cells cell = Cells.Unknown;

        switch (bullet)
        {
        case LevelPlayground.Bullets.Knife:
            cell = Cells.Cell_11;
            break;

        case LevelPlayground.Bullets.Pencil:
            cell = Cells.Cell_12;
            break;

        case LevelPlayground.Bullets.Sword:
            cell = Cells.Cell_21;
            break;

        case LevelPlayground.Bullets.Fork:
            cell = Cells.Cell_22;
            break;
        }

        return(cell);
    }
Exemple #3
0
    public static bool IsAvailableBullet(LevelPlayground.Bullets bullet)
    {
        int index = GetBulletIndex(bullet);

        if (index == -1)
        {
            return(false);
        }

        var purchases = Profile.Data.Purchases;

        if (purchases.Count > index && purchases[index] > 0)
        {
            return(true);
        }

        return(false);
    }
Exemple #4
0
    public static void AddAvailableBullet(LevelPlayground.Bullets bullet)
    {
        if (!IsAvailableBullet(bullet))
        {
            int index = GetBulletIndex(bullet);
            if (index == -1)
            {
                return;
            }

            var purchases = Profile.Data.Purchases;

            if (purchases.Count != NumberOfPurchases)
            {
                purchases.Clear();
                purchases.Add(1);
                purchases.Add(0);
                purchases.Add(0);
                purchases.Add(0);
            }

            purchases[index] = 1;
        }
    }