StartExecution() public method

Start a coroutine which executes all commands in the Block. Only one running instance of each Block is permitted.
public StartExecution ( ) : void
return void
 public void Execute()
 {
     if (block != null)
     {
         block.StartExecution();
     }
 }
Exemplo n.º 2
0
        protected virtual IEnumerator WaitForTimeout(float timeoutDuration, Block targetBlock)
        {
            float elapsedTime = 0;

            Slider timeoutSlider = GetComponentInChildren <Slider>();

            while (elapsedTime < timeoutDuration)
            {
                if (timeoutSlider != null)
                {
                    float t = 1f - elapsedTime / timeoutDuration;
                    timeoutSlider.value = t;
                }

                elapsedTime += Time.deltaTime;

                yield return(null);
            }

            Clear();
            gameObject.SetActive(false);

            HideSayDialog();

            if (targetBlock != null)
            {
                targetBlock.StartExecution();
            }
        }
        protected virtual IEnumerator WaitForTimeout(float timeoutDuration, Block targetBlock)
        {
            float elapsedTime = 0;
            
            Slider timeoutSlider = GetComponentInChildren<Slider>();
            
            while (elapsedTime < timeoutDuration)
            {
                if (timeoutSlider != null)
                {
                    float t = 1f - elapsedTime / timeoutDuration;
                    timeoutSlider.value = t;
                }
                
                elapsedTime += Time.deltaTime;
                
                yield return null;
            }
            
            Clear();
            gameObject.SetActive(false);

            HideSayDialog();

            if (targetBlock != null)
            {
                targetBlock.StartExecution();
            }
        }
Exemplo n.º 4
0
        public virtual void SetNextBlockFromName(string NextBlockToFire)
        {
            Flowchart flowchart = ParentBlock.GetFlowchart();
            Block     block     = flowchart.FindBlock(NextBlockToFire);

            if (block != null)
            {
                block.StartExecution();
            }
        }
Exemplo n.º 5
0
        public virtual bool AddOption(string text, bool interactable, Block targetBlock)
        {
            bool addedOption = false;

            foreach (Button button in cachedButtons)
            {
                if (!button.gameObject.activeSelf)
                {
                    button.gameObject.SetActive(true);

                    button.interactable = interactable;

                    if (interactable && autoSelectFirstButton && !cachedButtons.Select((x) => x.gameObject).Contains(EventSystem.current.currentSelectedGameObject))
                    {
                        EventSystem.current.SetSelectedGameObject(button.gameObject);
                    }

                    Text textComponent = button.GetComponentInChildren <Text>();
                    if (textComponent != null)
                    {
                        textComponent.text = text;
                    }

                    Block block = targetBlock;

                    button.onClick.AddListener(delegate {
                        EventSystem.current.SetSelectedGameObject(null);

                        StopAllCoroutines(); // Stop timeout
                        Clear();

                        HideSayDialog();

                        if (block != null)
                        {
                            #if UNITY_EDITOR
                            // Select the new target block in the Flowchart window
                            Flowchart flowchart     = block.GetFlowchart();
                            flowchart.selectedBlock = block;
                            #endif

                            gameObject.SetActive(false);

                            block.StartExecution();
                        }
                    });

                    addedOption = true;
                    break;
                }
            }

            return(addedOption);
        }
Exemplo n.º 6
0
        public void BlockTriggered(string blockName)
        {
            Debug.Log("Added start execution for " + blockName);
            Block block = ParentBlock;

            if (block != null)
            {
                if (block.BlockName == blockName)
                {
                    block.StartExecution();
                }
            }
        }
Exemplo n.º 7
0
        protected override IEnumerator WaitForTimeout(float timeoutDuration, Block targetBlock)
        {
            float elapsedTime = 0;

            Image timerSliderImg = TimerSliderImg;

            while (elapsedTime < timeoutDuration)
            {
                if (timerSliderImg != null)
                {
                    float t = 1f - elapsedTime / timeoutDuration;
                    timerSliderImg.GetComponent <Image>().fillAmount = t;
                }
                if (!Scessece)
                {
                    elapsedTime += Time.deltaTime;
                }

                yield return(null);
            }
            //播放消失动画了
            for (int i = 0; i < anims.Length; i++)
            {
                anims[i].Play("ef_ui_MenuDialog_MultiBtn_Option_over");
            }

            Invoke("Clear", 1f);
            // Clear();
            // gameObject.SetActive(false);

            HideSayDialog();

            //在这里把所有的按钮点击状态重置
            ResetBtnTack();

            if (targetBlock != null)
            {
                targetBlock.StartExecution();
            }
        }
Exemplo n.º 8
0
        protected override IEnumerator WaitForTimeout(float timeoutDuration, Block targetBlock)
        {
            float elapsedTime = 0;

            Image timerSliderImg = TimerSliderImg;

            while (elapsedTime < timeoutDuration)
            {
                if (timerSliderImg != null)
                {
                    float t = 1f - elapsedTime / timeoutDuration;
                    timerSliderImg.GetComponent <Image>().fillAmount = t;
                }
                if (!Scecess)
                {
                    elapsedTime += Time.deltaTime;
                }

                yield return(null);
            }

            OneBtnMultipleClick.canClick = false;
            //倒计时结束隐藏物体在这里
            anim.Play("ef_ui_MenuDialog_OneBtn_death");

            Invoke("Clear", 1f);

            //   Clear();
            //gameObject.SetActive(false);

            HideSayDialog();

            if (targetBlock != null)
            {
                targetBlock.StartExecution();
            }
        }
Exemplo n.º 9
0
        protected IEnumerator CallBlock(Block block)
        {
            yield return(new WaitForEndOfFrame());

            block.StartExecution();
        }
 protected IEnumerator CallBlock(Block block)
 {
     yield return new WaitForEndOfFrame();
     block.StartExecution();
 }