Esempio n. 1
0
        private void CreateParam(string name, Func <float> valueOnUpdate, Action <float> setValue, int deltaPow = -1)
        {
            CalibrationParam param = Instantiate(paramPrefab);

            param.name          = name;
            param.ValueOnUpdate = valueOnUpdate;
            param.SetValue      = setValue;

            param.transform.SetParent(transform);

            calibrationParams.Add(param);

            deltaPows.Add(deltaPow);
        }
Esempio n. 2
0
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.DownArrow) ||
                HoloKitInputManager.Instance.GetKeyDown(HoloKitKeyCode.S))
            {
                SelectedIndex = (SelectedIndex + 1) % calibrationParams.Count;
            }
            else if (Input.GetKeyDown(KeyCode.UpArrow) ||
                     HoloKitInputManager.Instance.GetKeyDown(HoloKitKeyCode.W))
            {
                int selected = (SelectedIndex - 1) % calibrationParams.Count;
                if (selected < 0)
                {
                    selected += calibrationParams.Count;
                }
                SelectedIndex = selected;
            }
            else if (Input.GetKeyDown(KeyCode.Period) ||
                     HoloKitInputManager.Instance.GetKeyDown(HoloKitKeyCode.Q))
            {
                deltaPows[SelectedIndex]++;
            }
            else if (Input.GetKeyDown(KeyCode.Comma) ||
                     HoloKitInputManager.Instance.GetKeyDown(HoloKitKeyCode.E))
            {
                deltaPows[SelectedIndex]--;
            }
            else if (Input.GetKey(KeyCode.RightArrow) ||
                     HoloKitInputManager.Instance.GetKeyDown(HoloKitKeyCode.D))
            {
                CalibrationParam param = calibrationParams[SelectedIndex];
                float            value = param.ValueOnUpdate();
                value += Mathf.Pow(deltaBase, deltaPows[SelectedIndex]);
                param.SetValue(value);
            }
            else if (Input.GetKey(KeyCode.LeftArrow) ||
                     HoloKitInputManager.Instance.GetKeyDown(HoloKitKeyCode.A))
            {
                CalibrationParam param = calibrationParams[SelectedIndex];
                float            value = param.ValueOnUpdate();
                value -= Mathf.Pow(deltaBase, deltaPows[SelectedIndex]);
                param.SetValue(value);
            }

            deltaLabel.text = string.Format("Delta = {0}", Mathf.Pow(deltaBase, deltaPows[SelectedIndex]));

            updateFps();
        }