Exemplo n.º 1
0
    public void selectOption(int option_id)
    {
        var    conversation = GameObject.Find("Conversation").GetComponent <Conversation_script>();
        string option       = "";

        switch (option_id)
        {
        case 0:
            option = conversations[conversation.conversation_id].option_1_type[conversation.dialogue_length];
            break;

        case 1:
            option = conversations[conversation.conversation_id].option_2_type[conversation.dialogue_length];
            break;

        default:
            break;
        }

        if (option.Contains("next"))
        {
            conversation.continueConversation();
        }

        if (option.Contains("exit"))
        {
            conversation.closeConversation();
        }

        if (option.Contains("finalexit"))
        {
            conversation.closeConversation();
            _characterStats.completed_conversations.Add(conversation.conversation_id);
        }

        if (option.Contains("item_add"))
        {
            if (!_characterStats.isInventoryFull())
            {
                string[] split = option.Split(':');
                _characterStats.itemPickup(int.Parse(split[1]), true);
                conversation.continueConversation();
            }
            else
            {
                conversation.closeConversation();
            }
        }

        if (option.Contains("change_dialog"))
        {
            string[] split = option.Split(':');
            conversation.showConversation(int.Parse(split[1]));
        }

        if (option.Contains("skip"))
        {
            string[] split = option.Split(':');
            conversation.dialogue_length = int.Parse(split[1]) - 1;
            conversation.continueConversation();
        }
        if (option.Contains("money_add"))
        {
            string[] split = option.Split(':');
            _characterStats.getMoney(int.Parse(split[1]));
            conversation.continueConversation();
        }
        if (option.Contains("money_remove"))
        {
            string[] split = option.Split(':');
            _characterStats.looseMoney(int.Parse(split[1]));
            conversation.continueConversation();
        }
        if (option.Contains("xp_add"))
        {
            string[] split = option.Split(':');
            _characterStats.getXP(int.Parse(split[1]));
            conversation.continueConversation();
        }
        if (option.Contains("quest_add"))
        {
            string[] split = option.Split(':');
            GameObject.Find("Game manager").GetComponent <Quest_manager_script>().acceptQuest(int.Parse(split[1]));
            conversation.continueConversation();
        }

        if (option.Contains("start_battle"))
        {
            _characterStats.completed_conversations.Add(conversation.conversation_id);
            string[] split = option.Split(':');
            GameObject.Find("Game manager").GetComponent <Game_manager>().Change_screen(battle_screen, false);
            GameObject.Find("Game manager").GetComponent <Combat_manager_script>().initializeBattle(int.Parse(split[1]));
            conversation.continueConversation();
        }
    }