示例#1
0
        private void Awake()
        {
            Log.GUI("Init VJR Awake");
            VJR = this;

            gameObject.transform.localScale = new Vector3(0, 0, 0);
            gameObject.transform.position   = new Vector3(0, 0, 999);
            if (Screen.width > Screen.height)
            {
                size = Screen.height;
            }
            else
            {
                size = Screen.width;
            }
            VJRvector        = new Vector2(0, 0);
            joystick         = gameObject.AddComponent("GUITexture") as GUITexture;
            joystick.texture = joystick2D;
            joystick.color   = inactiveColor;

            backOBJ = new GameObject("VJR-Joystick Back");
            backOBJ.transform.localScale = new Vector3(0, 0, 0);
            background         = backOBJ.AddComponent("GUITexture") as GUITexture;
            background.texture = background2D;
            background.color   = inactiveColor;
            var rsz  = GetRealSize();
            var pxin = new Rect(0, 0, (int)rsz.x, (int)rsz.y);

            background.pixelInset = pxin;

            fingerID     = -1;
            lastID       = -1;
            VJRdoubleTap = false;
            tapTimer     = 0;
            var rate = Mathf.Min(Screen.width / 1024.0f, Screen.height / 768.0f);

            length      = 80 * rate;
            position    = new Vector2((Screen.width / 3) / 2, (Screen.height / 3) / 2);
            origin      = position;
            gotPosition = false;
            EnableJoystick();
            enable = true;
        }
示例#2
0
 //
 void Destroy()
 {
     VJR = null;
 }