Ejemplo n.º 1
0
        /// <summary>
        /// updates the UI if there are any
        /// </summary>
        void Update()
        {
            if (selectablesUI.Count > 0)
            {
                // _____________ PANEL SELECTION TO UPDATE PROPERTIES __________________________________________________________
                if (OVRInput.GetDown(OVRInput.Button.PrimaryThumbstickDown) || Input.GetKeyDown(KeyCode.S))
                {
                    lineNumber++;
                    int linecount = GameObjectHelper.FindNumberOfChildsWithTag(GameObjectHelper.FindGameObjectInChildWithTag(selectablesUI[0], "Values"), "UiLine");
                    if (lineNumber >= linecount)
                    {
                        lineNumber = 0;
                    }

                    foreach (GameObject SelectableUI in selectablesUI)
                    {
                        SelectableUI.GetComponent <Designer>().SetLineNumber(lineNumber);
                        SelectableUI.GetComponent <Designer>().ModifyCanva();
                    }
                }

                if (OVRInput.GetDown(OVRInput.Button.PrimaryThumbstickUp) || Input.GetKeyDown(KeyCode.Z))
                {
                    lineNumber--;
                    int linecount = GameObjectHelper.FindNumberOfChildsWithTag(GameObjectHelper.FindGameObjectInChildWithTag(selectablesUI[0], "Values"), "UiLine");
                    if (lineNumber < 0)
                    {
                        var val = linecount - 1;
                        lineNumber = (val >= 0) ? val : 0;
                    }

                    foreach (GameObject SelectableUI in selectablesUI)
                    {
                        SelectableUI.GetComponent <Designer>().SetLineNumber(lineNumber);
                        SelectableUI.GetComponent <Designer>().ModifyCanva();
                    }
                }

                // upgrade/downgrade caracteristics of the object
                if (OVRInput.GetDown(OVRInput.Button.PrimaryThumbstickLeft) || Input.GetKeyDown(KeyCode.Q))
                {
                    downgradeItem();
                }
                if (OVRInput.GetDown(OVRInput.Button.PrimaryThumbstickRight) || Input.GetKeyDown(KeyCode.D))
                {
                    upgradeItem();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// the item selected gets downgraded
        /// </summary>
        private void downgradeItem()
        {
            if (obj != null)
            {
                updater.SetObjUpdated(obj);
                List <float> param = GetCurrentParameters();
                param[lineNumber] = param[lineNumber] - 1;
                updater.TryUpdating(param);

                foreach (GameObject SelectableUI in selectablesUI)
                {
                    SelectableUI.GetComponent <Designer>().TryDesigning(param);
                }
            }
        }