Add() public method

public Add ( string name, string label, string icon_path, bool popup ) : void
name string
label string
icon_path string
popup bool
return void
Esempio n. 1
0
    void givePlayerABadgeBook()
    {
        GameObject book = new GameObject();

        book.name = "Badges";
        book.AddComponent <BadgebookItem>();
        BadgebookItem item = book.GetComponent <BadgebookItem>();

        item.item_name = "Badges";

        Inventory inventory = GameObject.Find("Inventory").GetComponent <Inventory>();

        inventory.addItem(book);

        Badgebook badgebook = GameObject.Find("Badgebook").GetComponent <Badgebook>();

        badgebook.Add("helping_others", "Example Badge", "incomplete_helping_others_badge", false);

        bool badge_given = false;

        Enchantable.EnchantmentEnded += (spell_target, item_name) => {
            if (!badge_given)
            {
                badgebook.Complete("helping_others");
            }

            badge_given = true;
        };
    }
Esempio n. 2
0
    void givePlayerABadgeBook()
    {
        GameObject book = new GameObject();

        book.name = "Badges";
        book.AddComponent <BadgebookItem>();
        BadgebookItem item = book.GetComponent <BadgebookItem>();

        item.item_name = "Badges";

        Inventory inventory = GameObject.Find("Inventory").GetComponent <Inventory>();

        inventory.addItem(book);

        Badgebook badgebook = GameObject.Find("Badgebook").GetComponent <Badgebook>();

        badgebook.AddColumn(NUMBER_OF_QUESTS + 1);
        badgebook.Add("helping_others", "HELPING OTHERS", "incomplete_helping_others_badge", false);
        badgebook.Add("helping_others_picking_up_item", "  Pickin up Stuff", "incomplete_picking_up_item_badge", false);
        badgebook.Add("helping_others_cross_river", "  Cross River", "incomplete_crossing_river_badge", false);
        badgebook.Add("helping_others_reaching_up_high", "  New Heights", "incomplete_reaching_up_high_badge", false);
        badgebook.Add("helping_others_putting_something_high", "  Out of Reach", "incomplete_putting_something_high_badge", false);
        badgebook.Add("helping_others_putting_out_fire", "  Firefighter", "incomplete_putting_out_fire_badge", false);
        badgebook.Add("helping_others_light_fire", "  Light Fire", "incomplete_light_fire_badge", false);
        badgebook.Add("helping_others_unlevitate", "  Unlevitate", "incomplete_unlevitate_badge", false);
        badgebook.Add("helping_others_summonObject", "  Summon Object", "incomplete_summonObject_badge", false);
        badgebook.Add("collecting_objects_staff", "  Staff", "incomplete_collecting_objects_staff", false);

        badgebook.AddColumn(9);
        badgebook.Add("reading_your_book", "READING YOUR BOOK", "incomplete_reading_your_book_badge", false);
        badgebook.Add("reading_your_book_fire", "  Flames", "incomplete_cast_flame_badge", false);
        badgebook.Add("reading_your_book_sentry", "  Sentry", "incomplete_cast_sentry_badge", false);
        badgebook.Add("reading_your_book_adv_levitate", "  Adept Levitation", "incomplete_cast_levitate_badge", false);
        badgebook.Add("reading_your_book_flight", "  Flight", "incomplete_cast_flight_badge", false);
        badgebook.Add("reading_your_book_teleport", "  Teleportation", "incomplete_cast_teleport_badge", false);
        badgebook.Add("reading_your_book_summon", "  Summoning", "incomplete_cast_summoning_badge", false);
        badgebook.Add("reading_your_book_massive", "  Massive Fire", "incomplete_cast_massive_fire_badge", false);
        badgebook.Add("reading_your_book_architecture", "  Architecture", "incomplete_cast_architecture_badge", false);

        badgebook.AddColumn(8);
        badgebook.Add("square_dance", "  Square Dance", "incomplete_square_dance", false);
        badgebook.MakeButtonUnlockable("square_dance");
        badgebook.Add("creative_dance", "  Creative Dance", "incomplete_creative_dance", false);
        badgebook.MakeButtonUnlockable("creative_dance");
        badgebook.Add("massive_levitate", "  Massive Levitate", "incomplete_massive_levitate", false);
        badgebook.MakeButtonUnlockable("massive_levitate");
        badgebook.Add("massive_unlevitate", "  Massive Unlevitate", "incomplete_massive_unlevitate", false);
        badgebook.MakeButtonUnlockable("massive_unlevitate");
        badgebook.Add("massive_dance", "  Massive Dance", "incomplete_massive_dance", false);
        badgebook.MakeButtonUnlockable("massive_dance");
        badgebook.Add("follow_the_leader", "  Follow The Leader", "incomplete_follow_the_leader", false);
        badgebook.MakeButtonUnlockable("follow_the_leader");
        badgebook.Add("portal", "  Portal", "incomplete_portal", false);
        badgebook.MakeButtonUnlockable("portal");
        badgebook.Add("umbrella", "  Umbrella", "incomplete_umbrella", false);
        badgebook.MakeButtonUnlockable("umbrella");

        // To make a badge unlockable by an instructor, add
        // badgebook.MakeButtonUnlockable(<badge_name>);
        // example:
        // badgebook.MakeButtonUnlockable("reading_your_book");

        // mark badges as already complete
        markCompletedBadges();

        // mark areas that are already cleared
        getCompletedAreas();

        showAppropriateQuestArrows();

        //Set up the callbacks for unlocking the badges.
        //int num_unlocked = 0;
        Enchantable.EnchantmentEnded += (spell_target, item_name) => {
            bool success = false;
            if (item_name.StartsWith("Flame"))
            {
                success = badgebook.Complete("reading_your_book_fire");
            }

            if (item_name.StartsWith("Sentry"))
            {
                success = badgebook.Complete("reading_your_book_sentry");
            }

            if (item_name.StartsWith("Massive"))
            {
                success = badgebook.Complete("reading_your_book_massive");
            }

            if (item_name.StartsWith("Flight"))
            {
                success = badgebook.Complete("reading_your_book_flight");
            }

            if (item_name.StartsWith("AdeptLevitate"))
            {
                success = badgebook.Complete("reading_your_book_adv_levitate");
            }

            if (item_name.StartsWith("Summon"))
            {
                success = badgebook.Complete("reading_your_book_summon");
            }

            if (item_name.StartsWith("Teleport"))
            {
                success = badgebook.Complete("reading_your_book_teleport");
            }

            if (item_name.StartsWith("Architecture"))
            {
                success = badgebook.Complete("reading_your_book_architecture");
            }

            if (success)
            {
                num_unlocked++;
            }

            if (num_unlocked == 8)
            {
                badgebook.Complete("reading_your_book");
            }

            showAppropriateQuestArrows();
        };

        int collectedBread = 0;

        FlyQuestChecker.Levitated += () => {
            if (badgebook.Complete("helping_others_reaching_up_high"))
            {
                //GameObject.Find("LevitationQuestGnomeArmature").GetComponent<DisplayOnMinimap>().show = false;
                //GameObject.Find("LevitationQuestGnomeArmature").GetComponent<Icon3D>().show = false;
                helpingUnlocked++;
            }

            if (helpingUnlocked == NUMBER_OF_QUESTS)
            {
                badgebook.Complete("helping_others");
            }

            showAppropriateQuestArrows();
        };

        AudioSource main_audio = GameObject.Find("Voice").audio;

        AudioClip pickup_clip = Resources.Load("PickupArpeg") as AudioClip;

        int unlevitatingBoxes = 0;

        Unlevitate.UnlevitateQuest += () => {
            unlevitatingBoxes++;
            main_audio.PlayOneShot(pickup_clip);
            Popup.mainPopup.popup("Got it! (" + (3 - unlevitatingBoxes) + " left)");

            if (unlevitatingBoxes == 3)
            {
                if (badgebook.Complete("helping_others_unlevitate"))
                {
                    //GameObject.Find("UnlevitationQuestGnomeArmature").GetComponent<DisplayOnMinimap>().show = false;
                    //GameObject.Find("UnlevitationQuestGnomeArmature").GetComponent<Icon3D>().show = false;
                    //GameObject.Find("QuestUnlevitationCrate").GetComponent<Icon3D>().show = false;
                    //GameObject.Find("QuestUnlevitationCrate1").GetComponent<Icon3D>().show = false;
                    //GameObject.Find("QuestUnlevitationCrate2").GetComponent<Icon3D>().show = false;
                    helpingUnlocked++;
                }
            }

            if (helpingUnlocked == NUMBER_OF_QUESTS)
            {
                badgebook.Complete("helping_others");
            }
            //update current level for areas and log the area
            GameObject.Find("Area2").GetComponent <Area2>().area2 = true;
            AreaLogger.Log("Area2");

            showAppropriateQuestArrows();
        };

        SummonObject.SummonObjectQuest += () => {
            if (badgebook.Complete("helping_others_summonObject"))
            {
                //GameObject.Find("SummonObjectGnomeArmature").GetComponent<DisplayOnMinimap>().show = false;
                //GameObject.Find("SummonObjectGnomeArmature").GetComponent<Icon3D>().show = false;
                //GameObject.Find("SummonedObject").GetComponent<Icon3D>().show = false;

                //Destroy the yellow summoning block when they have summond the square to it.
                Destroy(GameObject.Find("SummonTo"));
                helpingUnlocked++;
            }

            if (helpingUnlocked == NUMBER_OF_QUESTS)
            {
                badgebook.Complete("helping_others");
            }

            showAppropriateQuestArrows();
        };

        CollectBread.CollectedBread += () => {
            collectedBread++;

            main_audio.PlayOneShot(pickup_clip);
            Popup.mainPopup.popup("Got it! (" + (12 - collectedBread) + " left)");

            if (12 == 12)
            {
                if (badgebook.Complete("helping_others_putting_something_high"))
                {
                    //GameObject.Find("FlyQuestGnomeArmature").GetComponent<DisplayOnMinimap>().show = false;
                    //GameObject.Find("FlyQuestGnomeArmature").GetComponent<Icon3D>().show = false;
                    helpingUnlocked++;
                }
            }

            if (helpingUnlocked == NUMBER_OF_QUESTS)
            {
                badgebook.Complete("helping_others");
            }

            showAppropriateQuestArrows();
            showAppropriateSpells(GameObject.Find("Badgebook"));
        };

        Inventory.PickedUp += (target) => {
            if (target.name.Equals("Presents"))
            {
                //Debug.Log("Trying to enable the Icon3D for Dance Quest");
                //GameObject.Find("DanceQuest").GetComponent<Icon3D>().color = Color.white;

                if (badgebook.Complete("helping_others_picking_up_item"))
                {
                    helpingUnlocked++;
                }
            }
            if (target.name.Equals("game_flag"))
            {
                if (badgebook.Complete("collecting_objects_staff"))
                {
                    helpingUnlocked++;
                }
            }
            if (helpingUnlocked == NUMBER_OF_QUESTS)
            {
                badgebook.Complete("helping_others");
            }

            showAppropriateQuestArrows();
        };

        Inventory.DroppedOff += (target) => {
            GameObject gnome    = GameObject.Find("QuestSwampGnomeEnd");
            GameObject presents = GameObject.Find("Presents");

            if (target.name.Equals("Presents") && Vector3.Distance(gnome.transform.position, presents.transform.position) < 10)
            {
                //GameObject.Find("QuestSwampGnomeEnd").GetComponent<Icon3D>().enabled = false;
                if (badgebook.Complete("helping_others_cross_river"))
                {
                    helpingUnlocked++;
                }
            }
            if (helpingUnlocked == NUMBER_OF_QUESTS)
            {
                badgebook.Complete("helping_others");
            }

            showAppropriateQuestArrows();
        };

        Flamable.Extinguished += (target) => {
            //Debug.Log("Extinguished was called with target: "+target.gameObject.name);
            if (target.name.Equals("QuestSummonCrate"))
            {
                Debug.Log("Completing the summoning quest");


                if (badgebook.Complete("helping_others_putting_out_fire"))
                {
                    helpingUnlocked++;
                }
            }
            if (helpingUnlocked == NUMBER_OF_QUESTS)
            {
                badgebook.Complete("helping_others");
            }

            showAppropriateQuestArrows();
        };

        Flamable.CaughtFire += (target) => {
            if (!crate1 && target.name.Equals("QuestFlammingCrate"))
            {
                crate1 = true;
                if (crate2)
                {
                    if (badgebook.Complete("helping_others_light_fire"))
                    {
                        helpingUnlocked++;
                    }
                }
            }

            if (!crate2 && target.name.Equals("QuestFlammingCrate1"))
            {
                crate2 = true;
                if (crate1)
                {
                    if (badgebook.Complete("helping_others_light_fire"))
                    {
                        helpingUnlocked++;
                    }
                }
            }
            if (helpingUnlocked == NUMBER_OF_QUESTS)
            {
                badgebook.Complete("helping_others");
            }

            showAppropriateQuestArrows();
        };
    }