Search Unity

How to add delay in between DoTween sequence instructions?

Discussion in 'Formats & External Tools' started by Meitheli, Apr 27, 2020.

  1. Meitheli

    Meitheli

    Joined:
    Jul 15, 2019
    Posts:
    5
    Following is my DoTween sequence code ( pasted only a little part). I am using yield to add delay between sequence instructions. Is there any way to add delay between sequence instructions without using yeild. Also , I want the sequence to be seekable just like a video. For that I have added a slider and as the sequence plays the slider keeps on going ahead which is working fine. Now, I want to give a button to pause and resume this sequence and also allow the user to move the slider and the sequence should start from that slider seek point.
    How can I achieve this?

    Code (CSharp):
    1.   mySequence.Append(mainCamera.transform.DOMove(new Vector3(target18.position.x, target18.position.y, target18.position.z), 2));
    2.             mySequence.Append(mainCamera.transform.DORotate(new Vector3(target18.localEulerAngles.x, target18.localEulerAngles.y, target18.localEulerAngles.z), 2));
    3.  
    4.             yield return new WaitForSeconds(2); //50
    5.  
    6.  
    7.             CallOutPanel.gameObject.SetActive(true);
    8.             CalloutText.text = "Oh, did you notice that damaged TV?";
    9.             AudioScript.current.PlayAudio(AudioScript.current.m_acAutoFlightAudio1);
    10.             #endregion
    11.  
    12.             #region Television Set Claim Assessment Demo
    13.  
    14.             yield return new WaitForSeconds(AudioScript.current.audioSource.clip.length + 1); //53.5
    15.             m_oMouseCursor.SetActive(true);
    16.             mySequence.Append(m_oMouseCursor.transform.DOMove(new Vector3(mouseTarget2.transform.position.x, mouseTarget2.transform.position.y,
    17.                                                                             mouseTarget2.transform.position.z), 2));
    18.             mySequence.Append(m_oMouseCursor.transform.DORotate(new Vector3(mouseTarget2.transform.localEulerAngles.x, mouseTarget2.transform.localEulerAngles.y,
    19.                                                                             mouseTarget2.transform.localEulerAngles.z), 2));
    20.             yield return new WaitForSeconds(2); //55.5
    21.             CursorClickAnimationPlayer.current.m_bPlayAnimation = true;
    22.             yield return new WaitForSeconds(0.5f);  //56
    23.             CursorClickAnimationPlayer.current.m_bPlayAnimation = false;
    24.             m_oMouseCursor.SetActive(false);
    25.  
    26.             #endregion
    27.  
    28.             #region UI & Bi-focal display
    29.  
    30.             #region Display Details Panel
    31.  
    32.             SampleDemoUI.SetActive(true);
    33.             //TransparentWhiteBG.color = new Color(255, 255, 255, 0.5f);
    34.             yield return new WaitForSeconds(1); //57
    35.  
    36.             originalBtn.GetComponent<Image>().color = new Color(255, 255, 255, 0.5f);
    37.             ImagePanelImg.color = new Color(255, 255, 255, 0.5f);
    38.  
    39.  
    40.             yield return new WaitForSeconds(3); //60
    41.             DetailsPanel.transform.SetAsLastSibling();
    42.             HighlighterImage.transform.SetAsLastSibling();
    43.             mySequence.Append(HighlighterImage.GetComponent<RectTransform>().DOAnchorPos(new Vector2(169, 15f), 0.5f));
    44.             mySequence.Append(HighlighterImage.transform.DOScale(new Vector3(3.91f, 2.63f, 1), 0.5f));
    45.             HighlighterImage.SetActive(true);
    46.             mySequence.Append(HighlighterImage.transform.DOShakeScale(6, 0.1f, 1, 10, true));
    47.             //callout & audio
    48.             CalloutText.text = "You can view the details of the object on the side.";
    49.             AudioScript.current.PlayAudio(AudioScript.current.m_acAutoFlightAudio2);
    50.             yield return new WaitForSeconds(AudioScript.current.audioSource.clip.length + 3);   //65.6
    51.  
     
    Last edited: Apr 28, 2020
  2. Hermonirr

    Hermonirr

    Joined:
    Dec 23, 2013
    Posts:
    56
    You could use
    Code (CSharp):
    1. mySequence.AppendInterval(float interval)
    to add the given interval to the end of the Sequence.
     
    Rumbleball, xNex, Veuch and 6 others like this.