public override async void MoveNext()
        {
            await Task.Delay(Mathf.CeilToInt(1000 * delay));

            isRunning = false;
            var count = DynamicPorts.Count();

            for (int i = 0; i < count; i++)
            {
                this.GetNextNode($"output {i}").Run();
            }
        }
        public NodePort GetForwardingPort()
        {
            NodePort selectorPort = GetOutputPort("selections");

            int selectValue = GetInputValue <int>("select");
            int numPorts    = DynamicPorts.Count();

            if (selectValue > numPorts || selectValue < 0)
            {
                return(null);
            }

            return(DynamicPorts.ElementAt(selectValue));
        }
Exemple #3
0
        public override async void Run()
        {
            base.Run();
            await Task.Delay(Mathf.CeilToInt(1000 * delay));

            var events           = new List <UnityEvent>();
            var optionTransforms = new List <Transform>();
            var count            = DynamicPorts.Count();

            for (int i = 0; i < count; i++)
            {
                var newEvent = new UnityEvent();
                var cacheI   = i;
                newEvent.AddListener(() => this.GetNextNode($"output {cacheI}").Run());

                if (i < options.Count && options[i].endDialog)
                {
                    newEvent.AddListener(() => SignalBusSingleton.Instance.Fire(new DialogOptionCancelRequest()));
                }

                events.Add(newEvent);
            }

            for (int i = 0; i < options.Count; i++)
            {
                optionTransforms.Add(options[i].transform);
            }

            if (haveExit)
            {
                var exitEvent = new UnityEvent();
                exitEvent.AddListener(() => this.GetNextNode($"exit").Run());
                SignalBusSingleton.Instance.Fire(new DialogOptionRequestSignal(dialogId, events, optionTransforms,
                                                                               exitEvent));
            }
            else
            {
                SignalBusSingleton.Instance.Fire(new DialogOptionRequestSignal(dialogId, events, optionTransforms));
            }

            isRunning = false;
        }
Exemple #4
0
        public override IEnumerator Execute(UVNFManager managerCallback, UVNFCanvas canvas)
        {
            List <string> choiceList = Choices;

            if (ShuffleChocies)
            {
                choiceList.Shuffle();
            }

            canvas.DisplayChoice(choiceList.ToArray(), HideDialogue);
            while (canvas.ChoiceCallback == -1)
            {
                yield return(null);
            }

            if (DynamicPorts.ElementAt(canvas.ChoiceCallback).IsConnected)
            {
                int choice = canvas.ChoiceCallback;
                canvas.ResetChoice();
                managerCallback.AdvanceStoryGraph(DynamicPorts.ElementAt(choice).Connection.node as StoryElement);
            }
        }
Exemple #5
0
 public void RemoveChoice(int index)
 {
     Choices.RemoveAt(index);
     RemoveDynamicPort(DynamicPorts.ElementAt(index));
 }