Example #1
0
 private void GenerateSpeech()
 {
     if (currentDialog.Count > 0)
     {
         IsDialog = true;
         var seq = LeanTween.sequence();
         seq.append(() => LeanTween.value(SpeechBubble.gameObject, (v) => SpeechBubble.size = v, SpeechBubble.size, new Vector2(10f, 2.5f), 0.3f));
         seq.append(0.3f);
         seq.append(() => SpeechText.text = currentDialog[0]);
         seq.append(() => currentDialog.RemoveAt(0)); //type in??
         seq.append(() => ContinueText.localScale = Vector3.one);
         seq.append(() => IsDialogReady           = true);
     }
     else
     {
         IsDialog = false;
         SpeechCanvas.SetActive(false);
         ReticleController.EnableControl();
     }
 }
    void Update()
    {
        sqrMag = rb2D.velocity.sqrMagnitude;
        if (timerToStop < 0f)
        {
            timerToStop = 0f;
            //rb2D.velocity = Vector2.zero;
        }
        else if (sqrMag < 0.1f && sqrMag >= 0f && timerToStop > 0f)
        {
            timerToStop -= Time.deltaTime;
        }
        else if (sqrMag > 0.1f)
        {
            timerToStop = timerToStopMax;
        }

        if (timerToStop <= 0f)
        {
            if (IsMoving)
            {
                //Enable Interaction on stop
                IsInteractable = true;
                //Enable Reticle on stop
                ReticleController.EnableControl();
            }
            IsMoving = false;
        }
        else
        {
            if (!IsMoving)
            {
                //Disable Interaction on move
                IsInteractable = false;
                //Disable Recticle on move
                ReticleController.DisableControl();
            }
            IsMoving = true;
        }
    }