Example #1
0
    private IEnumerator PlayText()
    {
        Color bgmColor = background.color;

        bgmColor.a       = 0;
        background.color = bgmColor;
        background.DOFade(1f, 1f);

        var text = storyText.text;

        storyText.text = string.Empty;
        yield return(new WaitForSeconds(1.5f));

        var charAnimationDuration = 0.13f;

        isTextCompleted = false;
        textTweener     = storyText.DOText(text, text.Length * charAnimationDuration)
                          .OnComplete(() => isTextCompleted = true);

        for (int i = 0; i < text.Length; i++)
        {
            charSfx.pitch = Random.Range(0.8f,
                                         1.2f);
            charSfx.Play();
            yield return(new WaitForSeconds(charAnimationDuration));

            if (isTextCompleted)
            {
                break;
            }
        }
    }
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player")
     {
         anim.DOText(fullName, 1f, scrambleMode: ScrambleMode.All);
         anim.DOFade(1f, 0.25f);
         activated(true);
     }
 }
Example #3
0
    public void InitMessage(string speakerName, IEnumerable <string> newMessage, float displayTime)
    {
        speaker.text = speakerName + ": ";
        StringBuilder sb = new StringBuilder();

        foreach (var line in newMessage)
        {
            sb.AppendLine(line);
        }
        message.DOText(sb.ToString(), displayTime, true);
    }
Example #4
0
        public override bool CreateTween(GameObject target, float duration, int loops, LoopType loopType)
        {
            TMP_Text tmpTextComponent = target.GetComponent <TMP_Text>();

            if (tmpTextComponent == null)
            {
                Debug.LogError($"{target} does not have {TargetComponentType} component");
                return(false);
            }

            TweenerCore <string, string, StringOptions> tween = tmpTextComponent.DOText(text, duration, richText, scrambleMode);

            SetTween(tween, loops, loopType);
            return(true);
        }
Example #5
0
 public void NewRoad(string roadName)
 {
     if (roadName != curRoad)
     {
         curRoad = roadName;
         if (roadName != "???")
         {
             if (!knownRoads.Contains(roadName))
             {
                 knownRoads.Add(roadName);
                 Notifications.RequestNotification("New road discovered", roadName);
             }
         }
         roadText.DOText(roadName, 0.25f, scrambleMode: ScrambleMode.All);
     }
 }
Example #6
0
    public void NextStation()
    {
        if (on)
        {
            currentStation++;
            if (currentStation == stations.Length)
            {
                currentStation = 0;
            }

            float t = source.time;
            source.clip = stations[currentStation].track;
            source.Play();
            source.time = t % source.clip.length;
            RollingText rt = radioDisplay.GetComponent <RollingText>();
            rt.enabled = false;
            radioDisplay.DOText(stations[currentStation].name, 1f, scrambleMode: ScrambleMode.All).OnComplete(() => { rt.enabled = true; });
        }
    }
 public void NextDay()
 {
     elapsed = 0f;
     currentDay++;
     dayText.DOText("Day " + currentDay, 0.5f, scrambleMode: ScrambleMode.All);
 }