Ejemplo n.º 1
0
        // OnEnable
        void OnEnable()
        {
            myTarget = ( DPadSpriteRenderer )target;

            AxesHelper.HelperSetup(myTarget);
            EventsHelper.HelperSetup(myTarget);
        }
        // OnEnable
        void OnEnable()
        {
            myTarget = ( DPadSpriteRenderer )target;

            AxesHelper.HelperSetup( myTarget );
            EventsHelper.HelperSetup( myTarget );
        }
        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();
        }