예제 #1
0
    private void GetTilt()
    {
        if (Input.GetKey(KeyCode.Keypad4))
        {
            m_TiltStates = e_TiltStates.TILTUP;
        }
        if (Input.GetKey(KeyCode.Keypad6))
        {
            m_TiltStates = e_TiltStates.TILTDOWN;
        }
        if (Input.GetKey(KeyCode.Keypad8))
        {
            m_TiltStates = e_TiltStates.TILTLEFT;
        }
        if (Input.GetKey(KeyCode.Keypad2))
        {
            m_TiltStates = e_TiltStates.TILTRIGHT;
        }

//        bool tiltLeft   = Input.GetKey(KeyCode.Alpha4);
//        bool tiltRight  = Input.GetKey(KeyCode.Alpha6);
//        bool tiltUp     = Input.GetKey(KeyCode.Alpha8);
//        bool tiltDown   = Input.GetKey(KeyCode.Alpha2);
        CheckTilt();
    }
예제 #2
0
    private void CheckTilt()
    {
        switch (m_TiltStates)
        {
        case e_TiltStates.IDLE:
            break;

        case e_TiltStates.TILTLEFT:
            transform.Rotate(Vector3.left);
            m_TiltStates = e_TiltStates.IDLE;
            break;

        case e_TiltStates.TILTRIGHT:
            transform.Rotate(Vector3.right);
            m_TiltStates = e_TiltStates.IDLE;
            break;

        case e_TiltStates.TILTUP:
            transform.Rotate(Vector3.up);
            m_TiltStates = e_TiltStates.IDLE;
            break;

        case e_TiltStates.TILTDOWN:
            transform.Rotate(Vector3.down);
            m_TiltStates = e_TiltStates.IDLE;
            break;
        }
    }