Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (!dif.sceneIsVisible)
        {
            return;
        }
        if (selection.isDone)
        {
            dif.changeSecne = true;
            dif.obscurecer();
            if (!dif.readyToChange)
            {
                return;
            }
            SceneManager.LoadScene("PROLOGO");
        }
        if (selection.bLetterMove)
        {
            selection.moveLetter();
            return;
        }
        if (selection.ismoveHand)
        {
            fila    = max_fila;
            columna = max_columna;
            this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            selection.ismoveHand    = false;
        }
        if (jostick_vertival)
        {
            if (!InputManager.jostickMoveVertical() && !InputManager.DOWNButton() && !InputManager.UPButton())
            {
                jostick_vertival = false;
            }
            else
            {
                return;
            }
        }
        if (jostick_horizontal)
        {
            if (!InputManager.jostickMoveHorizontal() && !InputManager.RightButton() && !InputManager.LefhtButton())
            {
                jostick_horizontal = false;
            }
            else
            {
                return;
            }
        }
        if ((InputManager.jostickMoveVertical() || InputManager.DOWNButton()))
        {
            if (InputManager.Joystick().y < 0 || InputManager.DOWNButton())
            {
                jostick_vertival = true;
                fila++;
                if (fila > max_fila)
                {
                    fila = 0;
                }
                this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            }
            //else if (Input.GetKeyDown(KeyCode.S))
            //{
            //    fila++;
            //    if (fila > max_fila)
            //        fila = 0;
            //    this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            //}
        }
        if ((InputManager.jostickMoveVertical() || InputManager.UPButton()))
        {
            if (InputManager.Joystick().y > 0 || InputManager.UPButton())
            {
                jostick_vertival = true;
                fila--;
                if (fila < 0)
                {
                    fila = max_fila;
                }
                this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            }
            //else if (Input.GetKeyDown(KeyCode.W))
            //{
            //    fila--;
            //    if (fila < 0)
            //        fila = max_fila;
            //    this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            //}
        }
        if (InputManager.jostickMoveHorizontal() || InputManager.RightButton())
        {
            if (InputManager.Joystick().x >= 0 || InputManager.RightButton())
            {
                jostick_horizontal = true;
                columna++;
                if (columna > max_columna)
                {
                    columna = 0;
                }
                this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            }
            //else if (Input.GetKeyDown(KeyCode.D))
            //{
            //    columna++;
            //    if (columna > max_columna)
            //        columna = 0;
            //    this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            //}
        }
        if (InputManager.jostickMoveHorizontal() || InputManager.LefhtButton())
        {
            if (InputManager.Joystick().x <= 0 || InputManager.LefhtButton())
            {
                jostick_horizontal = true;
                columna--;
                if (columna < 0)
                {
                    columna = max_columna;
                }
                this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            }
            //else if (Input.GetKeyDown(KeyCode.A))
            //{
            //    columna--;
            //    if (columna < 0)
            //        columna = max_columna;
            //    this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            //}
        }

        if (InputManager.AButton() || InputManager.YButton())
        {
            selection.addLetter(fila, columna);
        }
        if (InputManager.BButton())
        {
            selection.backspace();
        }
        if (InputManager.StartButton())
        {
            fila    = max_fila;
            columna = max_columna;
            this.transform.position = new Vector3(pos[fila][columna].x, pos[fila][columna].y, 0);
            selection.ismoveHand    = false;
        }
    }