예제 #1
0
    public static void SetItemFound(int itemFound, bool isCollectible, bool isChest)
    {
        Collectible newCollectible;

        if (isCollectible)
        {
            if (!instance.finalSpecialPanel.activeInHierarchy)
            {
                instance.finalSpecialPanel.SetActive(true);
            }

            int bonusAmount = 0;

            switch (itemFound)
            {
            case 1:
            {
                bonusAmount             = 1000;
                instance.gamePlayer.XP += 1000;
                ExpManager.UpdateXP(1000);

                newCollectible = new Collectible("Wooden Horse", 1);
                instance.gamePlayer.collection.Add(newCollectible);
                break;
            }

            case 2:
            {
                bonusAmount             = 2500;
                instance.gamePlayer.XP += 2500;
                ExpManager.UpdateXP(2500);        // found the bear

                newCollectible = new Collectible("Toy Bear", 2);
                instance.gamePlayer.collection.Add(newCollectible);
                break;
            }

            case 3:
            {
                bonusAmount             = 5000;
                instance.gamePlayer.XP += 5000;
                ExpManager.UpdateXP(5000);        // found the ornament

                newCollectible = new Collectible("Ornament", 3);
                instance.gamePlayer.collection.Add(newCollectible);
                break;
            }

            case 4:
            {
                bonusAmount             = 10000;
                instance.gamePlayer.XP += 10000;
                ExpManager.UpdateXP(10000);        // found the starfish

                newCollectible = new Collectible("Starfish", 4);
                instance.gamePlayer.collection.Add(newCollectible);
                break;
            }
            }
            instance.specialPoints    = instance.specialPoints + bonusAmount;
            instance.specialText.text = "Special:" + instance.specialPoints;
        }
        else
        {
            // if this was a chest, then we need to use the itemFound differently
            if (isChest)
            {
                instance.FoundMysteryChest(itemFound);
            }
            else
            {
                switch (itemFound)
                {
                // main level items
                case 0:
                {
                    // mountain blood
                    instance.mainItemSprite.sprite = instance.foundSprite;
                    foundMountainBlood             = true;
                    instance.gamePlayer.XP        += 1000;
                    ExpManager.UpdateXP(1000);
                    instance.gamePlayer.availableLevels[(int)instance.thisLevel].hasCompleted = true;
                    break;
                }

                case 1:
                {
                    instance.gamePlayer.XP += 500;
                    ExpManager.UpdateXP(500);
                    instance.levelBonusItemScore++;
                    instance.bonusItem1Sprite.sprite = instance.foundSprite;
                    instance.foundBonus1             = true;
                    instance.gamePlayer.availableLevels[(int)instance.thisLevel].foundCrystal1 = true;
                    break;
                }

                case 2:
                {
                    instance.gamePlayer.XP += 500;
                    ExpManager.UpdateXP(500);
                    instance.levelBonusItemScore++;
                    instance.bonusItem2Sprite.sprite = instance.foundSprite;
                    instance.foundBonus2             = true;
                    instance.gamePlayer.availableLevels[(int)instance.thisLevel].foundCrystal2 = true;
                    break;
                }

                // collectibles
                case 3:
                {
                    instance.gamePlayer.XP += 1;
                    ExpManager.UpdateXP(1);
                    instance.levelCoinCount++;
                    break;
                }

                case 4:
                {
                    instance.gamePlayer.XP += 5;
                    ExpManager.UpdateXP(5);
                    instance.levelGemCount++; break;
                }

                //case 5: { instance.FoundMysteryChest(itemFound); break; }//found the chest
                case 6: { instance.SetPoisoned(false); break; } //potion

                case 7: { break; }                              //jug

                case 8: { instance.EnableHalo(); break; }       //halo enabled

                case 9: { instance.EnableThrow(true); break; }  // found the shroom

                case 10: LevelCompleted(); break;

                default: { break; }
                }
            }
        }
    }