Ejemplo n.º 1
0
    public void Update()
    {
        if (rotateCamera)
        {
            Camera.main.transform.RotateAround(Vector3.zero, Vector3.up, Time.deltaTime * 10);
        }

        if (Input.GetKeyDown(KeyCode.H))//halt
        {
            if (coroutine != null)
            {
                StopCoroutine(coroutine);
            }
            RCP.resetCubePrefabPositions();
            RCP.RefreshPanels();
        }

        else if (Input.GetKeyDown(KeyCode.S))
        {
            Solve();
        }
        else if (Input.GetKeyDown(KeyCode.E))
        {
            EasyScrambleCube();
        }
        else if (Input.GetKeyDown(KeyCode.D))
        {
            ScrambleCube();
        }
    }
Ejemplo n.º 2
0
    public void Update()
    {
        if (rotateCamera)
        {
            Camera.main.transform.RotateAround(Vector3.zero, Vector3.up, Time.deltaTime * 10);
        }

        if (Input.GetKeyDown(KeyCode.H))//halt
        {
            if (coroutine != null)
            {
                StopCoroutine(coroutine);
            }
            RCP.resetCubePrefabPositions();
            RCP.RefreshPanels();
        }
        else if (Input.GetKeyDown(KeyCode.D))
        {
            SearchedAndTrimmedSolve();
        }
        else if (Input.GetKeyDown(KeyCode.S))
        {
            Solve();
        }
        else if (Input.GetKeyDown(KeyCode.R))
        {
            ScrambleCube();
        }
        else if (Input.GetKeyDown(KeyCode.F1))
        {
            runCheckerboard();
        }
        else if (Input.GetKeyDown(KeyCode.F2))
        {
            runSixDot();
        }
    }
Ejemplo n.º 3
0
    private void HandleInput()
    {
        //if (Input.GetKeyDown(KeyCode.S))
        //{
        //    ScrambleCube();
        //    SolutionString = Solve();
        //    SolutionArr = ParseMoves(SolutionString);
        //    Debug.Log(SolutionArr.Count);
        //    nextMove = 0;
        //    RCP.RefreshPanels();
        //}

        if (Input.GetKeyDown(KeyCode.N))
        {
            if (nextMove < SolutionArr.Count)
            {
                if (!RCP.Animating)
                {
                    Debug.Log(nextMove);
                    coroutine = StartCoroutine(RCP.animateCustomSequence(SolutionArr[nextMove++]));
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.B))
        {
            if (nextMove > 0)
            {
                if (!RCP.Animating)
                {
                    StartCoroutine(RCP.animateCustomSequence(invertMove(SolutionArr[--nextMove])));
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (!RCP.Animating)
            {
                StartCoroutine(RCP.animateCustomSequence(SubstringFromList(SolutionArr, false, nextMove, SolutionArr.Count)));
                nextMove = SolutionArr.Count;
            }
        }

        if (Input.GetKeyDown(KeyCode.Backspace))
        {
            if (!RCP.Animating)
            {
                StartCoroutine(RCP.animateCustomSequence(SubstringFromList(SolutionArr, true, 0, nextMove - 1)));
                nextMove = 0;
            }
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            //if (socket_connected)
            //socket.Send("Reset");
            RCP.ResetView();
            RCP.RC.RunCustomSequence(SubstringFromList(SolutionArr, true, 0));
            nextMove = 0;
            RCP.RefreshPanels();
        }

        //Move Camera

        m_currentMousePos = Input.mousePosition;

        if (Input.GetMouseButton(0))
        {
            m_delta    = m_currentMousePos - m_lastMousePos;
            m_delta.x /= Screen.currentResolution.width;
            m_delta.y /= Screen.currentResolution.height;
        }
        else
        {
            m_delta = Vector2.zero;
        }


        m_lastMousePos = m_currentMousePos;

        m_camera.RotateBy(m_delta.y, m_delta.x);
        m_camera.ZoomBy(-1 * Input.GetAxis("Mouse ScrollWheel"));
    }