Пример #1
0
    void TouchUpdate(ref TouchEvent evt)
    {
        //Debug.Log("BENY: " + Time.timeSinceLevelLoad +  " TouchUpdate : id=" + evt.Id + ", pos=" + evt.Position + ", delta=" + touch.deltaPosition);

        //Debug.Log(Time.timeSinceLevelLoad + " testing TouchUpdate : " + evt.Position);

        //
        if (m_States.Move.Enabled)
        {
            if (m_MoveJoystick.FingerID == evt.Id)
            {
//				if (MoveJoystick.IsInside(touch))
                Rect r        = GuiOptions.leftHandAiming ? rightArea : leftArea;
                Rect moveArea = new Rect(Screen.width * r.x, Screen.height * r.y, Screen.width * r.width, Screen.height * r.height);

                if (moveArea.Contains(evt.Position))
                {
                    m_MoveJoystick.OnTouchUpdate(ref evt);
                }
                else
                {
                    m_MoveJoystick.OnTouchEnd(ref evt);
                }
                return;
            }
//			else if ( MoveJoystick.FingerID == -1 && MoveJoystick.IsInside(touch) && !FingerIdInUse(touch, false) && GuiOptions.m_ControlScheme == GuiOptions.E_ControlScheme.Scheme1 )
            else if (m_MoveJoystick.FingerID == -1 && m_MoveJoystick.IsInside(ref evt))
            {
                if (!FingerIdInUse(ref evt, false))
                {
                    m_MoveJoystick.OnTouchBegin(ref evt);
                }
            }
        }

        m_ViewJoystick.Yaw   = 0;
        m_ViewJoystick.Pitch = 0;

        if (m_States.View.Enabled && m_ViewJoystick.FingerID == evt.Id)
        {
            if (m_ViewJoystick.IsInside(ref evt))
            {
                ViewJoystickUpdate(ref evt);
            }
            else
            {
                m_ViewJoystick.OnTouchEnd(ref evt);
            }
            //  //Debug.Log("enabled");
        }
        //else
        //  //Debug.Log("disabled " + _States.View.Enabled  + " "  + ViewJoystick.FingerID + " " + evt.Id);

//        //Debug.Log(ViewJoystick.Yaw + " " + ViewJoystick.Pitch);
    }