Пример #1
0
        void Update()
        {
            if (current == null)
            {
                current = scenes[index];
                index++;

                textDone  = false;
                textTime  = 0f;
                pauseTime = 0f;
                transTime = 0f;
            }
            else if (!textDone)
            {
                if (InputManager.GetKey(KeyCode.Space, 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;
            }
        }
Пример #2
0
 public void Update()
 {
     if (transform.GetChild(0).gameObject.activeSelf&& InputManager.GetKey(KeyCode.F, inputLevel))
     {
         currentTime += Time.deltaTime;
         if (currentTime >= harvestTime)
         {
             var inst = Instantiate(itemObj, transform.position + new Vector3(0, 2, 0), new Quaternion());
             inst.GetComponent <ItemController>().item = item;
             currentTime = 0f;
         }
     }
 }
Пример #3
0
 public void Update()
 {
     inputMove = InputManager.GetHorzAxis(inputLevel);
     inputJump = InputManager.GetKey(KeyCode.Space, inputLevel);
     inputDash = InputManager.GetKey(KeyCode.LeftShift, inputLevel);
 }