Exemple #1
0
    //when entering a room with attached event, it should call set event
    public void SetEvent(EventDialogue eventDialogue)
    {
        currentEvent = eventDialogue;
        Character c = ScriptableObject.CreateInstance("Character") as Character;

        c.Init(eventDialogue.eventStats);
        SetCharacter(c, false);
        highlight.sprite  = SpriteLibrary.GetCharSprite(c.GetSpriteHeader() + "_Highlight");
        highlight.enabled = false;
    }
Exemple #2
0
 public void SetEventUnit(EventDialogue e)
 {
     if (e == null)
     {
         eventUnit.gameObject.SetActive(false);
         return;
     }
     eventUnit.SetEvent(e);
     eventUnit.gameObject.SetActive(true);
 }
Exemple #3
0
    private void Start()
    {
        _name = "Forgeron";

        _questManager  = GameObject.Find("QuestTable").GetComponent <QuestManager>();
        _toggle        = new Toggle();
        _eventDialogue = new EventDialogue();
        _switchQuest   = new SwitchQuest();
        _switchState   = new SwitchState();
        _switchAction  = new SwitchAction();
    }
 public void SetEvent(EventDialogue e)
 {
     roomEvent = e;
     if (e == null)
     {
         exitTrigger = false;
     }
     else
     {
         exitTrigger = e.ignore != null;
     }
 }
Exemple #5
0
 //starting event should stop map controller from moving
 //combat should also stop map movement
 public void StartEvent(EventDialogue e)
 {
     currentEvent = e;
     gameObject.SetActive(true);
     characterSelection.Init(state.ally);
     text.ClearDialogue();
     foreach (string s in currentEvent.dialogueText)
     {
         text.CreateDialogue(s);
     }
     foreach (EventChoice c in currentEvent.choices)
     {
         text.CreateChoice(c);
     }
     text.NextLine();
 }
Exemple #6
0
 private void PrivateAction()
 {
     if (current is EventDialogue)
     {
         EventDialogue ev = (EventDialogue)current;
         dialogueBox.text += "\n" + "Recibiste " + ev.rewardToRecieve.ToString() + ": " + ((ev.goldOrHp != 0) ? ev.goldOrHp.ToString() : ev.item);
     }
     if (current is DiceDialogue)
     {
         DiceDialogue dice = (DiceDialogue)current;
         int          num  = Random.Range(0, 30);
         if (num < dice.difficulty)
         {
             current = dice.fail;
         }
         else
         {
             current = dice.next;
             ShowDialogue();
         }
     }
 }
    private void RemoveDialogue(int dialogueIndex, bool affectOptions)
    {
        GameObject       boxTailObject         = null;
        TextBox          boxComponent          = null;
        GameObject       boxObject             = null;
        EventDialogue    boxMasterEvent        = null;
        QuestionRole     boxQuestionRole       = QuestionRole.None;
        IOptionsListener savedQuestionDelegate = null;
        int savedOptionIndex = -1;

        if (boxObjects != null)
        {
            if ((dialogueIndex > -1) && (dialogueIndex < boxObjects.Length))
            {
                /*halmeida - relying on the coherence of all box related arrays.*/
                boxTailObject = boxTailObjects[dialogueIndex];
                if (boxTailObject != null)
                {
                    GameObject.Destroy(boxTailObject);
                    boxTailObjects[dialogueIndex] = null;
                }
                boxComponent = boxComponents[dialogueIndex];
                if (boxComponent != null)
                {
                    boxComponent.Clear();
                    boxComponents[dialogueIndex] = null;
                }
                boxObject = boxObjects[dialogueIndex];
                if (boxObject != null)
                {
                    GameObject.Destroy(boxObject);
                    boxObjects[dialogueIndex] = null;
                }
                boxMasterEvent = boxMasterEvents[dialogueIndex];
                if (boxMasterEvent != null)
                {
                    boxMasterEvent.ReactToDialogueEnd();
                    boxMasterEvents[dialogueIndex] = null;
                }
                boxQuestionRole = boxQuestionRoles[dialogueIndex];
                UsefulFunctions.DecreaseArray <SpriteRenderer>(ref boxTailRenderers, dialogueIndex);
                UsefulFunctions.DecreaseArray <GameObject>(ref boxTailObjects, dialogueIndex);
                UsefulFunctions.DecreaseArray <bool>(ref boxTryAboves, dialogueIndex);
                UsefulFunctions.DecreaseArray <int>(ref boxSpeakerIDs, dialogueIndex);
                UsefulFunctions.DecreaseArray <int>(ref boxOptionIndexes, dialogueIndex);
                UsefulFunctions.DecreaseArray <QuestionRole>(ref boxQuestionRoles, dialogueIndex);
                UsefulFunctions.DecreaseArray <EventDialogue>(ref boxMasterEvents, dialogueIndex);
                UsefulFunctions.DecreaseArray <TextBox>(ref boxComponents, dialogueIndex);
                UsefulFunctions.DecreaseArray <GameObject>(ref boxObjects, dialogueIndex);
                if ((boxQuestionRole == QuestionRole.Option) && (questionDelegate != null) && affectOptions)
                {
                    CloseQuestion();
                }
                else if (boxQuestionRole == QuestionRole.Enunciate)
                {
                    /*halmeida - send choice to questionDelegate, reset variables to allow preparation for other questions.*/

                    /*halmeida - we need to immediately remove the remaining options, because if a new question is loaded
                     * now, as we send the chosen index, and any remaining options of this closed question happen to be removed after
                     * that, the closure of the old option will trigger the closure of the new question entirely, before the player is
                     * given the chance of choosing anything or even the chance of seeing the new question.*/
                    RemoveRemainingOptions();

                    /*halmeida - when we send the choice, the questionDelegate may immediately start a new question, assigning
                     * itself or another questionDelegate to this TextBoxManager in the process. If we remove the question prep
                     * after sending the choice, we may be losing this new question's preparation. That's why we need to send
                     * the chosen choice only after the removal of the preparation of the current question, not before. To do
                     * that we need to save the values first.*/
                    savedQuestionDelegate = questionDelegate;
                    savedOptionIndex      = optionChosenIndex;
                    RemoveQuestionPreparation();
                    if (savedQuestionDelegate != null)
                    {
                        savedQuestionDelegate.ChooseOption(savedOptionIndex);
                    }
                }
            }
        }
    }
    public bool ShowDialogue(string agentName, string dialogue, bool tryAbove, bool autoClose, EventDialogue masterEvent = null,
                             QuestionRole questionRole = QuestionRole.None)
    {
        GameObject     boxObject          = null;
        TextBox        boxComponent       = null;
        int            boxSpeakerID       = BaseAgent.INVALID_AGENT_ID;
        Vector2        boxDimensions      = Vector2.zero;
        Vector2        boxOffset          = Vector2.zero;
        Vector3        boxPosition        = Vector3.zero;
        bool           boxPositionValid   = false;
        BaseAgent      agentComponent     = null;
        GameObject     boxTailObject      = null;
        SpriteRenderer boxTailRenderer    = null;
        Vector2        tailOffset         = Vector2.zero;
        int            optionCurrentIndex = -1;

        if (!QuestionRoleAvailable(questionRole))
        {
            return(false);
        }
        else
        {
            if (questionRole != QuestionRole.None)
            {
                autoClose = false;
            }
        }
        if ((textBoxParent != null) && (symbolDatabase != null) && (dialogue != null) && (cameraObject != null))
        {
            if (stage != null)
            {
                boxSpeakerID = stage.GetAgentID(agentName, ref agentComponent);
            }
            if (boxSpeakerID == BaseAgent.INVALID_AGENT_ID)
            {
                /*halmeida - this is not a character's dialogue text, so it is system info text.*/
                boxObject    = new GameObject("SystemTextBox");
                boxComponent = boxObject.AddComponent <TextBox>();
                boxComponent.SetBoxLimits(systemBoxLimits.x, systemBoxLimits.y);
                boxComponent.SetEssentials(symbolDatabase, bodySpriteSystem, dialogue, 0f, TextBox.TextAlignment.AlignLeft, autoClose,
                                           BOX_OPENING_SPEED);
            }
            else
            {
                boxObject    = new GameObject("DialogueTextBox");
                boxComponent = boxObject.AddComponent <DialogueBox>();
                boxComponent.SetBoxLimits(dialogueBoxLimits.x, dialogueBoxLimits.y);
                boxComponent.SetEssentials(symbolDatabase, bodySpriteDialogue, dialogue, TextBox.DEFAULT_TEXT_SPEED,
                                           TextBox.TextAlignment.AlignLeft, autoClose, BOX_OPENING_SPEED);
                if (agentComponent != null)
                {
                    boxComponent.SetSpeakerName(agentComponent.GetCurrentName());
                    if (questionRole != QuestionRole.Option)
                    {
                        boxComponent.SetOrnamentPortrait(agentComponent.agentPortrait);
                    }
                }
                if (questionRole == QuestionRole.None)
                {
                    boxTailObject          = new GameObject("DialogueBoxTail");
                    boxTailRenderer        = boxTailObject.AddComponent <SpriteRenderer>();
                    boxTailRenderer.sprite = tailSpriteDialogue;
                }
            }
            boxComponent.Build();
            boxDimensions = boxComponent.GetBoxWorldDimensions();
            switch (questionRole)
            {
            case QuestionRole.None:
                boxPosition = GetBoxPositionForAgent(boxSpeakerID, boxDimensions, tryAbove, ref boxPositionValid, ref tailOffset);
                break;

            case QuestionRole.Enunciate:
                boxPosition = GetBoxPositionForEnunciate(boxDimensions, ref boxPositionValid);

                /*halmeida - with the dimensions of the enunciate set, I can already determine the area available
                 * for the options.*/
                optionAreaHeight  = 2f * enunciateBoxTopOffset;
                optionAreaHeight *= ((enunciateBoxTopOffset < 0) ? -1f : 1f);
                optionAreaHeight -= boxDimensions.y;
                if (optionsToAllocate > 0)
                {
                    optionAreaHeight = optionAreaHeight / optionsToAllocate;
                }
                optionHalfAreaHeight = optionAreaHeight / 2f;
                optionBoxTopOffset   = enunciateBoxTopOffset - boxDimensions.y;
                /*halmeida - enunciate text boxes cannot react to any input.*/
                boxComponent.BlockReactions();
                enunciateBoxComponent = boxComponent;
                optionAwaitedIndex    = 0;
                break;

            case QuestionRole.Option:
                boxPosition = GetBoxPositionForOption(optionAwaitedIndex, boxDimensions, ref boxPositionValid);
                /*halmeida - option text boxes can only react to precise input over them.*/
                boxComponent.AllowReactions(true);
                optionCurrentIndex = optionAwaitedIndex;
                optionAwaitedIndex++;
                break;
            }
            if (boxPositionValid)
            {
                boxObject.transform.SetParent(textBoxParent.transform, false);

                /*halmeida - since the textBoxParent is at x = 0 and y = 0, I can use the local position of its
                 * children as if it was their position. Changing just the local position is faster.*/
                boxObject.transform.localPosition = boxPosition;
                if (boxTailObject != null)
                {
                    boxTailObject.transform.SetParent(boxObject.transform, false);
                    boxTailObject.transform.localPosition = new Vector3(tailOffset.x, tailOffset.y, boxComponent.GetBoxToTextDepth());
                    if (tailOffset.y > 0f)
                    {
                        boxTailObject.transform.rotation = Quaternion.Euler(0f, 0f, 180f);
                    }
                }
                boxComponent.Open();
                UsefulFunctions.IncreaseArray <GameObject>(ref boxObjects, boxObject);
                UsefulFunctions.IncreaseArray <TextBox>(ref boxComponents, boxComponent);
                UsefulFunctions.IncreaseArray <EventDialogue>(ref boxMasterEvents, masterEvent);
                UsefulFunctions.IncreaseArray <QuestionRole>(ref boxQuestionRoles, questionRole);
                UsefulFunctions.IncreaseArray <int>(ref boxOptionIndexes, optionCurrentIndex);
                UsefulFunctions.IncreaseArray <int>(ref boxSpeakerIDs, boxSpeakerID);
                UsefulFunctions.IncreaseArray <bool>(ref boxTryAboves, tryAbove);
                UsefulFunctions.IncreaseArray <GameObject>(ref boxTailObjects, boxTailObject);
                UsefulFunctions.IncreaseArray <SpriteRenderer>(ref boxTailRenderers, boxTailRenderer);
                return(true);
            }
            boxComponent.Clear();
            GameObject.Destroy(boxObject);
            if (boxTailObject != null)
            {
                GameObject.Destroy(boxTailObject);
            }
        }
        return(false);
    }
Exemple #9
0
 public void EndEvent()
 {
     currentEvent = null;
 }
    private void RemoveDialogue(int dialogueIndex, bool affectOptions)
    {
        TextBoxUI        boxComponent          = null;
        GameObject       boxObject             = null;
        EventDialogue    boxMasterEvent        = null;
        QuestionRole     boxQuestionRole       = QuestionRole.None;
        IOptionsListener savedQuestionDelegate = null;
        int  savedOptionIndex  = -1;
        bool lastOptionToClose = false;

        if (boxObjects != null)
        {
            if ((dialogueIndex > -1) && (dialogueIndex < boxObjects.Length))
            {
                /*halmeida - relying on the coherence of all box related arrays.*/
                boxComponent = boxComponents[dialogueIndex];
                if (boxComponent != null)
                {
                    boxComponent.Clear();
                    boxComponents[dialogueIndex] = null;
                }
                boxObject = boxObjects[dialogueIndex];
                if (boxObject != null)
                {
                    GameObject.Destroy(boxObject);
                    boxObjects[dialogueIndex] = null;
                }
                boxMasterEvent = boxMasterEvents[dialogueIndex];
                if (boxMasterEvent != null)
                {
                    boxMasterEvent.ReactToDialogueEnd();
                    boxMasterEvents[dialogueIndex] = null;
                }
                boxMasterItems[dialogueIndex] = null;
                boxQuestionRole = boxQuestionRoles[dialogueIndex];
                UsefulFunctions.DecreaseArray <int>(ref boxOptionIndexes, dialogueIndex);
                UsefulFunctions.DecreaseArray <QuestionRole>(ref boxQuestionRoles, dialogueIndex);
                UsefulFunctions.DecreaseArray <EventDialogue>(ref boxMasterEvents, dialogueIndex);
                UsefulFunctions.DecreaseArray <ItemData>(ref boxMasterItems, dialogueIndex);
                UsefulFunctions.DecreaseArray <TextBoxUI>(ref boxComponents, dialogueIndex);
                UsefulFunctions.DecreaseArray <GameObject>(ref boxObjects, dialogueIndex);
                /*halmeida - if there are no more items associated with dialogues, we update the related variable.*/
                itemOnDisplay = (boxMasterItems == null) ? false : itemOnDisplay;
                if (itemOnDisplay)
                {
                    itemOnDisplay = false;
                    for (int i = 0; i < boxMasterItems.Length; i++)
                    {
                        if (boxMasterItems[i] != null)
                        {
                            itemOnDisplay = true;
                            break;
                        }
                    }
                }

                /*halmeida - the chosen option closes before the others, as a visual feedback to the player as to
                 * which option did he choose. If there was more than one available choice, we start closing them when
                 * the closure of the chosen one ends. We only send the chosen index to the delegate by the time all
                 * options have finished closing.*/
                if ((boxQuestionRole == QuestionRole.Option) && (questionDelegate != null))
                {
                    /*halmeida - since we don't really require an enunciate, I can't use the end of the closure of the
                     * enunciate as the trigger to send the chosen option and prepare for another question. I will use the
                     * end of the closure of the last option as this trigger.*/
                    lastOptionToClose = (boxQuestionRoles == null);
                    if (!lastOptionToClose)
                    {
                        lastOptionToClose = true;
                        for (int i = 0; i < boxQuestionRoles.Length; i++)
                        {
                            if (boxQuestionRoles[i] == QuestionRole.Option)
                            {
                                lastOptionToClose = false;
                            }
                        }
                    }
                    if (lastOptionToClose)
                    {
                        /*halmeida - send choice to questionDelegate, reset variables to allow preparation for other questions.*/

                        /*halmeida - when we send the choice, the questionDelegate may immediately start a new question, assigning
                         * itself or another questionDelegate to this TextBoxManager in the process. If we remove the question prep
                         * after sending the choice, we may be losing this new question's preparation. That's why we need to send
                         * the chosen choice only after the removal of the preparation of the current question, not before. To do
                         * that we need to save the values first.*/
                        savedQuestionDelegate = questionDelegate;
                        savedOptionIndex      = optionChosenIndex;
                        RemoveQuestionPreparation();
                        if (savedQuestionDelegate != null)
                        {
                            savedQuestionDelegate.ChooseOption(savedOptionIndex);
                        }
                    }
                    else
                    {
                        if (affectOptions)
                        {
                            CloseQuestion();
                        }
                    }
                }
            }
        }
    }
    public bool ShowDialogue(string dialogueText, float dialogueTextSpeed, Sprite dialoguePicture, bool autoClose, Vector2 boxMaxSizeRates,
                             Vector2 boxCenterPositionRates, EventDialogue masterEvent = null, ItemData masterItem = null, QuestionRole questionRole = QuestionRole.None)
    {
        GameObject    boxObject          = null;
        TextBoxUI     boxComponent       = null;
        RectTransform boxTransform       = null;
        Vector2       boxPosition        = Vector2.zero;
        int           optionCurrentIndex = -1;

        if (!QuestionRoleAvailable(questionRole))
        {
            return(false);
        }
        else
        {
            if (questionRole != QuestionRole.None)
            {
                autoClose = false;
            }
        }
        if (uiCanvasTrans != null)
        {
            if (((symbolDatabase != null) && (dialogueText != null)) || (dialoguePicture != null))
            {
                boxObject    = new GameObject("UITextBox", typeof(RectTransform));
                boxComponent = boxObject.AddComponent <TextBoxUI>();
                boxComponent.SetInterfaceCanvasTransform(uiCanvasTrans);
                boxComponent.SetBoxSizeLimitRates(boxMaxSizeRates.x, boxMaxSizeRates.y);
                boxComponent.SetEssentials(symbolDatabase, bodySprite, dialogueText, dialogueTextSpeed, TextBoxUI.TextAlignment.AlignMiddle,
                                           dialoguePicture, autoClose, 0f, 0.7f, new Vector2(0.1f, 0.1f), Vector2.one, BOX_OPENING_SPEED);
                boxComponent.Build();
                switch (questionRole)
                {
                case QuestionRole.Enunciate:
                    /*halmeida - enunciate text boxes cannot react to any input.*/
                    boxComponent.BlockReactions();
                    enunciateBoxComponent = boxComponent;
                    break;

                case QuestionRole.Option:
                    /*halmeida - option text boxes can only react to precise input over them.*/
                    boxComponent.AllowReactions(true);
                    optionCurrentIndex = optionAwaitedIndex;
                    optionAwaitedIndex++;
                    break;
                }
                boxTransform = boxObject.GetComponent <RectTransform>();
                boxTransform.SetParent(uiCanvasTrans, false);
                boxTransform.anchoredPosition = GetCanvasPositionFromScreenRates(boxCenterPositionRates);
                boxComponent.Open();
                UsefulFunctions.IncreaseArray <GameObject>(ref boxObjects, boxObject);
                UsefulFunctions.IncreaseArray <TextBoxUI>(ref boxComponents, boxComponent);
                UsefulFunctions.IncreaseArray <EventDialogue>(ref boxMasterEvents, masterEvent);
                UsefulFunctions.IncreaseArray <ItemData>(ref boxMasterItems, masterItem);
                UsefulFunctions.IncreaseArray <QuestionRole>(ref boxQuestionRoles, questionRole);
                UsefulFunctions.IncreaseArray <int>(ref boxOptionIndexes, optionCurrentIndex);
                if (masterItem != null)
                {
                    itemOnDisplay = true;
                }
                return(true);
            }
        }
        return(false);
    }
Exemple #12
0
    private void SaveConversation()
    {
        BaseScriptableObject lastNode = null;

        for (int i = 0; i < windows.Count; i++)

        {
            if (windows[i] is StartNode)
            {
                StartNode nodeNew = (StartNode)windows[i];
                Dialogue  start   = ScriptableObjectUtility.CreateAsset <Dialogue>();
                //start.name = "Start";
                start.start     = true;
                start.windowPos = nodeNew.windowRect;
                lastNode        = start;
                ScriptToDelete.Add((BaseScriptableObject)start);
            }
            if (windows[i] is DialogueNode)
            {
                DialogueNode nodeNew     = (DialogueNode)windows[i];
                Dialogue     npcDialogue = ScriptableObjectUtility.CreateAsset <Dialogue>();
                npcDialogue.dialogue  = nodeNew.text;
                npcDialogue.windowPos = nodeNew.windowRect;
                if (lastNode != null)
                {
                    lastNode.next = npcDialogue;
                }
                lastNode = npcDialogue;
                ScriptToDelete.Add((BaseScriptableObject)npcDialogue);
            }
            if (windows[i] is EventNode)
            {
                EventNode     nodeNew     = (EventNode)windows[i];
                EventDialogue npcDialogue = ScriptableObjectUtility.CreateAsset <EventDialogue>();
                npcDialogue.dialogue        = nodeNew.text;
                npcDialogue.rewardToRecieve = nodeNew.reward;
                if (nodeNew.healthPoints != 0)
                {
                    npcDialogue.goldOrHp = nodeNew.healthPoints;
                }
                else if (nodeNew.gold != 0)
                {
                    npcDialogue.goldOrHp = nodeNew.gold;
                }
                else
                {
                    npcDialogue.item = nodeNew.itemId;
                }

                npcDialogue.windowPos = nodeNew.windowRect;

                if (lastNode != null)
                {
                    lastNode.next = npcDialogue;
                }
                lastNode = npcDialogue;

                ScriptToDelete.Add((BaseScriptableObject)npcDialogue);
            }
            if (windows[i] is EndNode)
            {
                EndNode endNode          = (EndNode)windows[i];
                BaseScriptableObject end = ScriptableObjectUtility.CreateAsset <BaseScriptableObject>();
                //end.name = "End";
                end.dialogue  = "Finished";
                end.windowPos = endNode.windowRect;
                lastNode.next = end;
                //lastNode = end;
                ScriptToDelete.Add((BaseScriptableObject)end);
            }
            if (windows[i] is DiceRollNode)
            {
                DiceRollNode nodeNew     = (DiceRollNode)windows[i];
                DiceDialogue npcDialogue = ScriptableObjectUtility.CreateAsset <DiceDialogue>();
                npcDialogue.roll       = nodeNew.rollType;
                npcDialogue.difficulty = nodeNew.difficulty;
                npcDialogue.windowPos  = nodeNew.windowRect;
                ScriptToDelete.Add((BaseScriptableObject)npcDialogue);
                if (lastNode != null)
                {
                    lastNode.next = npcDialogue;
                }
                i++;
                EndNode endNode          = (EndNode)windows[i];
                BaseScriptableObject end = ScriptableObjectUtility.CreateAsset <BaseScriptableObject>();
                //end.name = "End";
                end.dialogue     = endNode.finished;
                end.windowPos    = endNode.windowRect;
                npcDialogue.fail = end;
                lastNode         = npcDialogue;
                ScriptToDelete.Add((BaseScriptableObject)end);
            }
        }
    }
Exemple #13
0
    public void ReloadConversation(Object dragged)
    {
        /*  BaseNode selNode = windows[0];
         * windows.RemoveAt(0);
         *
         * foreach (BaseNode n in windows)
         * {
         *    n.NodeDeleted(selNode);
         * }*/

        BaseScriptableObject dialogue = (BaseScriptableObject)dragged;
        BaseInputNode        lastDiag;

        Dialogue  start     = (Dialogue)dialogue;
        StartNode startNode = (StartNode)windows[0];

        startNode.windowRect = start.windowPos;
        lastDiag             = startNode;
        BaseScriptableObject lastDiagScriptObj = start;


        while (dialogue.next != null)
        {
            ScriptToDelete.Add(dialogue);

            if (dialogue is Dialogue)
            {
                Dialogue npcDialogue = (Dialogue)dialogue;

                if (!npcDialogue.start)
                {
                    DialogueNode newNode = new DialogueNode();
                    newNode.windowRect = npcDialogue.windowPos;
                    newNode.text       = npcDialogue.dialogue;
                    newNode.hasInput   = true;
                    newNode.input1     = lastDiag;
                    newNode.input1Rect = lastDiag.windowRect;
                    lastDiag           = newNode;
                    windows.Add(newNode);
                }

                // dialogue = dialogue.next;
            }
            else if (dialogue is EventDialogue)
            {
                EventDialogue npcDialogue = (EventDialogue)dialogue;
                EventNode     newNode     = new EventNode();
                newNode.windowRect = npcDialogue.windowPos;
                newNode.text       = npcDialogue.dialogue;
                newNode.reward     = npcDialogue.rewardToRecieve;
                if (newNode.reward == DialogueEventType.EventReward.gold)
                {
                    newNode.gold = npcDialogue.goldOrHp;
                }
                else if (newNode.reward == DialogueEventType.EventReward.life)
                {
                    newNode.healthPoints = npcDialogue.goldOrHp;
                }
                else
                {
                    newNode.itemId = npcDialogue.item;
                }

                newNode.hasInput   = true;
                newNode.input1     = lastDiag;
                newNode.input1Rect = lastDiag.windowRect;
                lastDiag           = newNode;
                windows.Add(newNode);
            }
            else if (dialogue is DiceDialogue)
            {
                DiceDialogue diceRoll = (DiceDialogue)dialogue;
                DiceRollNode newNode  = new DiceRollNode();
                newNode.windowRect = diceRoll.windowPos;
                newNode.rollType   = diceRoll.roll;
                newNode.difficulty = diceRoll.difficulty;
                newNode.hasInput   = true;
                newNode.input1     = lastDiag;
                newNode.input1Rect = lastDiag.windowRect;
                //BaseScriptableObject endObj = diceRoll.fail;
                EndNode newEnd = new EndNode();
                newEnd.windowRect    = diceRoll.fail.windowPos;
                newEnd.finished      = diceRoll.fail.dialogue;
                newEnd.hasInput      = true;
                newEnd.inputNode     = newNode;
                newEnd.inputNodeRect = newNode.windowRect;
                ScriptToDelete.Add(diceRoll.fail);
                lastDiag = newNode;
                windows.Add(newNode);
                windows.Add(newEnd);
            }

            lastDiagScriptObj = dialogue;
            Debug.Log("asdasd");
            dialogue = dialogue.next;
        }
        EndNode lastEnd = new EndNode();

        lastEnd.windowRect    = lastDiagScriptObj.next.windowPos;
        lastEnd.finished      = lastDiagScriptObj.next.dialogue;
        lastEnd.hasInput      = true;
        lastEnd.inputNode     = lastDiag;
        lastEnd.inputNodeRect = lastDiag.windowRect;
        ScriptToDelete.Add(lastDiagScriptObj.next);
        windows.Add(lastEnd);
        Debug.Log("ultimo alcanzado");
        Repaint();
    }
 private void Awake()
 {
     instance = this;
 }
Exemple #15
0
 public void SetUpRoom(EventDialogue eventDialogue)
 {
     state.gc.SetEventUnit(eventDialogue);
     StartCoroutine(BackgroundEnterRoom());
 }