Пример #1
0
        //================================================================================

        void OnGUI()
        {
            if (!Application.isPlaying)
            {
                virtuaTouchpadScript = GetComponent <VirtualTouchpad> ();
                virtuaTouchpadScript.CalculateRects();
                foreach (VirtualTouchpad.Touchpad t in virtuaTouchpadScript.virtualTouchpads)
                {
                    if (t.backgroundTexture && t.enabled)
                    {
                        GUI.DrawTexture(t.touchpadScreenRect, t.backgroundTexture);
                    }
                }

                virtualJoystickScript = GetComponent <VirtualJoystick>();
                virtualJoystickScript.CalculateRects();
                foreach (VirtualJoystick.Joystick j in virtualJoystickScript.virtualJoysticks)
                {
                    if (j.backgroundTexture && j.enabled)
                    {
                        GUI.DrawTexture(j.backgroundRect, j.backgroundTexture);
                    }
                    if (j.buttonTexture && j.enabled)
                    {
                        GUI.DrawTexture(j.buttonRect, j.buttonTexture);
                    }
                }

                virtualButtonScript = GetComponent <VirtualButton>();
                virtualButtonScript.CalculateRects();
                foreach (VirtualButton.Button b in virtualButtonScript.virtualButtons)
                {
                    if (b.buttonTexture && b.enabled)
                    {
                        GUI.DrawTexture(b.buttonRect, b.buttonTexture);
                    }
                }
            }
        }         // void OnGUI()
Пример #2
0
        //================================================================================

        void Awake()
        {
            virtuaTouchpadScript  = GetComponent <VirtualTouchpad>();
            virtualJoystickScript = GetComponent <VirtualJoystick>();
            virtualButtonScript   = GetComponent <VirtualButton>();
        }