Beispiel #1
0
        void Update()
        {
            if (current == null)
            {
                current = scenes[index];
                index++;

                textDone  = false;
                textTime  = 0f;
                pauseTime = 0f;
                transTime = 0f;
            }
            else if (!textDone)
            {
                if (InputManager.GetJump(inputLevel))
                {
                    textTime += Time.deltaTime * buttonMulti;
                }
                else
                {
                    textTime += Time.deltaTime;
                }

                var text = current.GetComponent <UnityEngine.UI.Text>().text;
                var len  = Math.Min(Mathf.FloorToInt(textTime * textSpeed), text.Length);

                textArea.GetComponent <TMP_Text>().text = text.Substring(0, len);

                if (len >= text.Length)
                {
                    textDone = true;
                }
            }
            else if (pauseTime < pauseLength)
            {
                pauseTime += Time.deltaTime;
            }
            else if (index >= scenes.Count)
            {
                OnDone.Invoke();
                Destroy(this);
            }
            else if (transTime < (1f / transSpeed))
            {
                transTime += Time.deltaTime;

                current.GetComponent <SpriteRenderer>().material.color = new Color(1f, 1f, 1f, 1 - transTime * transSpeed);
                textArea.GetComponent <TMP_Text>().faceColor           = new Color32(255, 255, 255, Convert.ToByte(Mathf.RoundToInt(255f * (1 - transTime * transSpeed))));
            }
            else
            {
                textArea.GetComponent <TMP_Text>().text      = "";
                textArea.GetComponent <TMP_Text>().faceColor = new Color32(255, 255, 255, 255);

                current = null;
            }
        }
Beispiel #2
0
 public void Update()
 {
     inputMove = InputManager.GetHorzAxis(inputLevel);
     inputJump = InputManager.GetJump(inputLevel);
     inputFire = InputManager.GetFire(inputLevel);
 }