コード例 #1
0
        private static void CreateDPad()
        {
            if (!tckGUIobj)
            {
                CreateTouchManager();
            }

            SetupController <DPadSpriteRenderer>(ref DpadMain, tckGUIobj.transform, "DPad" + FindObjectsOfType <DPadSpriteRenderer>().Length.ToString());
            DPadSpriteRenderer dpadTemp = DpadMain.GetComponent <DPadSpriteRenderer>();

            DPadArrowSpriteRenderer tempArrow = null;

            //
            SetupController <DPadArrowSpriteRenderer>(ref DpadArrowUP, DpadMain.transform, "ArrowUP");
            tempArrow                      = DpadArrowUP.GetComponent <DPadArrowSpriteRenderer>();
            tempArrow.ArrowType            = DPadArrowBase.ArrowTypes.UP;
            DpadArrowUP.transform.rotation = Quaternion.Euler(0f, 0f, 90f);
            //
            SetupController <DPadArrowSpriteRenderer>(ref DpadArrowDOWN, DpadMain.transform, "ArrowDOWN");
            tempArrow           = DpadArrowDOWN.GetComponent <DPadArrowSpriteRenderer>();
            tempArrow.ArrowType = DPadArrowBase.ArrowTypes.DOWN;
            DpadArrowDOWN.transform.rotation = Quaternion.Euler(0f, 0f, 270f);
            //
            SetupController <DPadArrowSpriteRenderer>(ref DpadArrowLEFT, DpadMain.transform, "ArrowLEFT");
            tempArrow           = DpadArrowLEFT.GetComponent <DPadArrowSpriteRenderer>();
            tempArrow.ArrowType = DPadArrowBase.ArrowTypes.LEFT;
            DpadArrowLEFT.transform.rotation = Quaternion.Euler(0f, 0f, 180f);
            //
            SetupController <DPadArrowSpriteRenderer>(ref DpadArrowRIGHT, DpadMain.transform, "ArrowRIGHT");
            tempArrow           = DpadArrowRIGHT.GetComponent <DPadArrowSpriteRenderer>();
            tempArrow.ArrowType = DPadArrowBase.ArrowTypes.RIGHT;
            //
            SetupController <TouchzoneResizeEvents>(ref DpadTouchzone, DpadMain.transform, "touchzone");

            dpadTemp.myData.touchzoneSprite    = DpadTouchzone.GetComponent <SpriteRenderer>();
            dpadTemp.myData.touchzoneTransform = DpadTouchzone.transform;

            dpadTemp.myData.touchzoneSprite.sprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/Touchzone.png");
            dpadTemp.normalSprite  = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/ArrowNormal.png");
            dpadTemp.pressedSprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/ArrowPressed.png");

            dpadTemp.MyName = DpadMain.name;

            dpadTemp.myData.OffsetX = Random.Range(-50f, 50f);
            dpadTemp.myData.OffsetY = Random.Range(-50f, 50f);

            TouchManagerSpriteRenderer.Obsolete();
        }
コード例 #2
0
        private static void CreateButton()
        {
            if (!tckGUIobj)
            {
                CreateTouchManager();
            }

            SetupController <ButtonSpriteRenderer>(ref Button, tckGUIobj.transform, "Button" + FindObjectsOfType <ButtonSpriteRenderer>().Length.ToString());
            ButtonSpriteRenderer btnTemp = Button.GetComponent <ButtonSpriteRenderer>();

            btnTemp.normalSprite              = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/ButtonNormal.png");
            btnTemp.pressedSprite             = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/ButtonPressed.png");
            btnTemp.myData.touchzoneTransform = Button.transform;
            btnTemp.MyName         = Button.name;
            btnTemp.myData.OffsetX = Random.Range(-50f, 50f);
            btnTemp.myData.OffsetY = Random.Range(-50f, 50f);

            TouchManagerSpriteRenderer.Obsolete();
        }
コード例 #3
0
        private static void CreateSteeringWheel()
        {
            if (!tckGUIobj)
            {
                CreateTouchManager();
            }

            SetupController <SteeringWheelSpriteRenderer>(ref SteeringWheel, tckGUIobj.transform, "SteeringWheel" + FindObjectsOfType <SteeringWheelSpriteRenderer>().Length.ToString());
            SteeringWheelSpriteRenderer swTemp = SteeringWheel.GetComponent <SteeringWheelSpriteRenderer>();

            swTemp.myData.touchzoneSprite        = SteeringWheel.GetComponent <SpriteRenderer>();
            swTemp.myData.touchzoneSprite.sprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/SteeringWheel.png");
            swTemp.MyName = SteeringWheel.name;
            swTemp.myData.touchzoneTransform            = SteeringWheel.transform;
            swTemp.myData.OffsetX                       = Random.Range(-50f, 50f);
            swTemp.myData.OffsetY                       = Random.Range(-50f, 50f);
            swTemp.myData.touchzoneTransform.localScale = new Vector3(2.45f, 2.45f, 1f);

            TouchManagerSpriteRenderer.Obsolete();
        }
コード例 #4
0
        private static void CreateTouchpad()
        {
            if (!tckGUIobj)
            {
                CreateTouchManager();
            }

            SetupController <TouchpadSpriteRenderer>(ref Touchpad, tckGUIobj.transform, "Touchpad" + FindObjectsOfType <TouchpadSpriteRenderer>().Length.ToString());
            TouchpadSpriteRenderer tpTemp = Touchpad.GetComponent <TouchpadSpriteRenderer>();

            tpTemp.myData.touchzoneSprite        = Touchpad.GetComponent <SpriteRenderer>();
            tpTemp.myData.touchzoneSprite.sprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/Touchzone.png");
            tpTemp.MyName = Touchpad.name;
            tpTemp.myData.touchzoneTransform            = Touchpad.transform;
            tpTemp.myData.OffsetX                       = Random.Range(-50f, 50f);
            tpTemp.myData.OffsetY                       = Random.Range(-50f, 50f);
            tpTemp.myData.touchzoneTransform.localScale = new Vector3(1f, 0.7f, 1f);

            TouchManagerSpriteRenderer.Obsolete();
        }
コード例 #5
0
        private static void CreateJoystick()
        {
            if (!tckGUIobj)
            {
                CreateTouchManager();
            }

            SetupController <JoystickSpriteRenderer>(ref JoystickMain, tckGUIobj.transform, "Joystick" + FindObjectsOfType <JoystickSpriteRenderer>().Length.ToString());

            SetupController <SpriteRenderer>(ref JoystickBackgr, JoystickMain.transform, "JoystickBackgr");
            SetupController <SpriteRenderer>(ref Joystick, JoystickBackgr.transform, "Joystick");
            SetupController <TouchzoneResizeEvents>(ref JoystickTouchzone, JoystickMain.transform, "touchzone");

            JoystickSpriteRenderer joyTemp = JoystickMain.GetComponent <JoystickSpriteRenderer>();

            joyTemp.joystickBackgroundSprite = JoystickBackgr.GetComponent <SpriteRenderer>();
            joyTemp.joystickBackgroundSprite.sortingOrder = 1;
            joyTemp.joystickBackgroundTR = JoystickBackgr.transform;

            joyTemp.joystickSprite = Joystick.GetComponent <SpriteRenderer>();
            joyTemp.joystickSprite.sortingOrder = 2;
            joyTemp.joystickTR = Joystick.transform;

            joyTemp.myData.touchzoneSprite    = JoystickTouchzone.GetComponent <SpriteRenderer>();
            joyTemp.myData.touchzoneTransform = JoystickTouchzone.transform;

            joyTemp.joystickBackgroundSprite.sprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/JoystickBack.png");
            joyTemp.joystickSprite.sprite           = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/Joystick.png");
            joyTemp.myData.touchzoneSprite.sprite   = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/Touchzone.png");

            joyTemp.MyName = JoystickMain.name;

            joyTemp.myData.OffsetX = Random.Range(-50f, 50f);
            joyTemp.myData.OffsetY = Random.Range(-50f, 50f);

            joyTemp.myData.touchzoneTransform.localScale = new Vector3(0.5f, 0.6f, 1f);

            TouchManagerSpriteRenderer.Obsolete();
        }