コード例 #1
0
        void Awake()
        {
            if (!_instance)
            {
                _instance = this;
            }

            distanceBetweenMenus -= IsDivisble(distanceBetweenMenus, 0.5f);

            _maxMenuPosition = (menuItems.Length + 1) * distanceBetweenMenus;

            startingMenuItem = Mathf.Clamp(startingMenuItem, 1, menuItems.Length);

            _currentMenuPosition = ((1) * distanceBetweenMenus) * startingMenuItem;

            ParentMenuItems();
            UpdateMenuItemsPositionInWorldSpace();

            if (GetComponent <TouchHandler> () == null)
            {
                gameObject.AddComponent <TouchHandler> ();
            }

            _swipeHandler = GetComponent <SwipeHandler> ();

            if (_swipeHandler == null)
            {
                _swipeHandler = gameObject.AddComponent <SwipeHandler> ();
            }
        }
コード例 #2
0
ファイル: Menu.cs プロジェクト: htwgavin/InfoMotion
        void Awake()
        {
            transform.SetAsFirstSibling();
            if (!_instance)
            {
                _instance = this;
            }

            distanceBetweenMenus -= IsDivisble(distanceBetweenMenus, 0.5f);

            _maxMenuPosition = (menuItems.Length + 1) * distanceBetweenMenus;

            startingMenuItem = Mathf.Clamp(startingMenuItem, 1, menuItems.Length);

            _currentMenuPosition = ((1) * distanceBetweenMenus) * startingMenuItem;

            ParentMenuItems();
            //	UpdateMenuItemsPositionInWorldSpace ();

            if (GetComponent <TouchHandler> () == null && GetComponent <TouchHandlerMusik>() == null)
            {
                gameObject.AddComponent <TouchHandler> ();
            }

            _swipeHandler = GetComponent <SwipeHandler> ();

            if (_swipeHandler == null)
            {
                _swipeHandler = gameObject.AddComponent <SwipeHandler> ();
            }

            hc.GetLeapController().EnableGesture(Gesture.GestureType.TYPESWIPE);
        }
コード例 #3
0
        void Awake()
        {
            if (!_instance)
            {
                _instance = this;
            }

            button = buttonObj.GetComponent <Button> ();

            pointText = pointTextObj.GetComponent <TextMeshProUGUI> ();

            nameText  = nameTextObj.GetComponent <TextMeshProUGUI> ();
            priceText = priceTextObj.GetComponent <TextMeshProUGUI> ();

            distanceBetweenMenus -= IsDivisble(distanceBetweenMenus, 0.5f);

            _maxMenuPosition = (menuItems.Length + 1) * distanceBetweenMenus;

            startingMenuItem = EncryptedPlayerPrefs.LoadInt(Const.KEY_CHARA, 0);

            selectItem = menuItems [startingMenuItem];

            SetCanvasText();

            startingMenuItem = Mathf.Clamp((startingMenuItem + 1), 1, menuItems.Length);

            _currentMenuPosition = ((1) * distanceBetweenMenus) * startingMenuItem;

            ParentMenuItems();
            UpdateMenuItemsPositionInWorldSpace();

            if (GetComponent <TouchHandler> () == null)
            {
                gameObject.AddComponent <TouchHandler> ();
            }

            _swipeHandler = GetComponent <SwipeHandler> ();

            if (_swipeHandler == null)
            {
                _swipeHandler = gameObject.AddComponent <SwipeHandler> ();
            }
        }
コード例 #4
0
 void Start()
 {
     _swipeHandler = GetComponent <SwipeHandler> ();
 }