IEnumerator ReadSequence(SequenceObject sequence, int beginingNodeId = -1)
    {
        if (beginingNodeId != -1)
        {
            currentNode = sequence.GetNode(sequence.GetNode(beginingNodeId).nextNodeId);
        }
        else
        {
            currentNode = sequence.GetNode(sequence.firstNodeId);
        }

        int nextNodeId = -1;

        int newId;

        canRead = true;

        nodeHandler.InitNodes();

        while (currentNode != null && canRead)
        {
            if (currentNode.GetType() != typeof(WaitForInputNode) &&
                currentNode.GetType() != typeof(GoToSequenceNode) &&
                currentNode.GetType() != typeof(GoToPlaceNode) &&
                currentNode.GetType() != typeof(GoToExplorationNode) &&
                nodeHandler.CanGoNextNode(false, out newId))
            {
                if (newId != -1)
                {
                    currentNode = sequence.GetNode(newId);
                }
                else
                {
                    nodeHandler.HandleNode(currentNode);

                    nextNodeId = nodeHandler.GetNextNodeId(currentNode);

                    currentNode = sequence.GetNode(nextNodeId);
                }
            }
            else if (currentNode.GetType() == typeof(WaitForInputNode))
            {
                if (inputGetter.click /*Input.GetMouseButtonUp(0)*/ && nodeHandler.CanGoNextNode(true, out newId))
                {
                    nextNodeId = nodeHandler.GetNextNodeId(currentNode);

                    currentNode = sequence.GetNode(nextNodeId);
                }
            }
            else if (currentNode.GetType() == typeof(GoToSequenceNode))
            {
                if (nodeHandler.CanGoNextNode(false, out newId))
                {
                    ChangeSequence(((GoToSequenceNode)currentNode).sequenceId, false);
                }
            }
            else if (currentNode.GetType() == typeof(GoToPlaceNode))
            {
                if (nodeHandler.CanGoNextNode(false, out newId))
                {
                    ChangePlace(((GoToPlaceNode)currentNode).placeId);
                }
            }
            else if (currentNode.GetType() == typeof(GoToExplorationNode))
            {
                if (nodeHandler.CanGoNextNode(false, out newId))
                {
                    ChangeExploration(((GoToExplorationNode)currentNode).explorationId);
                }
            }

            yield return(null);
        }

        Debug.Log("End Sequence");

        if (canRead)
        {
            if (currentSequence.invokedByExploration)
            {
                nodeHandler.ClearNodes();
            }
            else if (currentSequence.invokedByNode != -1 && currentSequence.invokedBySequence != "")
            {
                ChangeSequence(currentSequence.invokedBySequence, false, currentSequence.invokedByNode);
            }
        }

        yield return(null);
    }