Beispiel #1
0
//Functions that contains exact crafting
    bool craft_id1_id1001(int slot2)
    {
        Inventory.item_remove(Inventory.items [slot2]);

        if (Inventory.items.Count < Inventory.inventory_space)
        {
            Inventory.item_add(Resources.Load <Item>("Inventory/Items/Timber"));
        }
        else
        {
            drop_item(Resources.Load <Item>("Inventory/Items/Timber"));
        }


        string said_text   = "I've managed to create Timber stick.";
        float  wanted_time = 3f;

        StartCoroutine(crafting_response(said_text, wanted_time, 2f));

        return(true);
    }
Beispiel #2
0
    IEnumerator interact()
    {
        if (settings.already_interacting)
        {
            yield break;
        }
        settings.already_interacting = true;

        playercontroller.bool_cutscene = true;

        playercontroller.bool_player_moves = false;
        playercontroller.float_movexaxis   = 0f;
        playercontroller.float_moveyaxis   = 0f;

        string say_this;
        string say_this_cze;
        float  want_time;
        float  current_time;

        if (first_interaction)
        {
            first_interaction = false;

            say_this     = "I need something to repair this fence.";
            say_this_cze = "Potřebuji něco, čím opravím ten plot.";
            want_time    = 2f;

            StartCoroutine(dialog.say_something(dialog.player_name, say_this, say_this_cze, want_time, dialog.player_portrait[player_head.GetInteger("emotion")], player_head));

            want_time   += 0.1f;
            current_time = 0f;

            while (current_time < want_time)
            {
                current_time += Time.deltaTime;

                if (settings.GetComponent <Settings>().cutscene_skip)
                {
                    break;
                }

                yield return(null);
            }
            yield return(null);
        }

        Inventory_ui.interactive_open = true;
        if (!settings.inventory_opened)
        {
            Inventory_ui.open_close_inventory();
        }

        yield return(new WaitForSeconds(0.01f));

        int got_id = -1;

        if (Inventory_ui.interactive_open)
        {
            switch (Inventory_ui.selected_slot)
            {
            case 10:
                if (Inventory.melee_weapon != null)
                {
                    got_id = Inventory.melee_weapon.ID;
                }
                break;

            case 11:
                if (Inventory.ranged_weapon != null)
                {
                    got_id = Inventory.ranged_weapon.ID;
                }
                break;

            default:
                if (Inventory.items.Count > Inventory_ui.selected_slot)
                {
                    got_id = Inventory.items [Inventory_ui.selected_slot].ID;
                }
                break;
            }
        }
        if (got_id == wanted_id)
        {
            Inventory.item_remove(Inventory.items [Inventory_ui.selected_slot]);

            yield return(new WaitForSeconds(2f));

            fence_animation.SetBool("repaired", true);

            say_this     = "I've repaired the fence!";
            say_this_cze = "Opravil jsem plot!";
            want_time    = 2f;

            StartCoroutine(dialog.say_something(dialog.player_name, say_this, say_this_cze, want_time, dialog.player_portrait[player_head.GetInteger("emotion")], player_head));

            current_time = 0f;

            while (current_time < want_time)
            {
                current_time += Time.deltaTime;

                if (settings.GetComponent <Settings>().cutscene_skip)
                {
                    break;
                }

                yield return(null);
            }
            yield return(null);


            game_manager.fence_t_repaired = true;
            GameObject.Find("cutscene_object").GetComponent <cutscene01> ().cutscene5_prepare();
        }
        else if (got_id >= 1 && got_id <= 500)
        {
            yield return(new WaitForSeconds(0.5f));

            say_this     = "Why would I want to destroy that fence? I am supposed to repair it!";
            say_this_cze = "Proč bych měl ničit ten plot? Mám ho přece opravit, a ne rozbít!";
            want_time    = 4f;

            StartCoroutine(dialog.say_something(dialog.player_name, say_this, say_this_cze, want_time, dialog.player_portrait[player_head.GetInteger("emotion")], player_head));

            current_time = 0f;

            while (current_time < want_time)
            {
                current_time += Time.deltaTime;

                if (settings.GetComponent <Settings>().cutscene_skip)
                {
                    break;
                }

                yield return(null);
            }
            yield return(null);
        }
        else
        {
            yield return(new WaitForSeconds(0.5f));

            say_this     = "This is not working...";
            say_this_cze = "Takhle to nefunguje...";
            want_time    = 2f;

            StartCoroutine(dialog.say_something(dialog.player_name, say_this, say_this_cze, want_time, dialog.player_portrait[player_head.GetInteger("emotion")], player_head));

            current_time = 0f;

            while (current_time < want_time)
            {
                current_time += Time.deltaTime;

                if (settings.GetComponent <Settings>().cutscene_skip)
                {
                    break;
                }

                yield return(null);
            }
            yield return(null);
        }

        yield return(null);


        playercontroller.bool_cutscene = false;

        settings.already_interacting = false;
    }