コード例 #1
0
        void SaveAxesDefault(EIU_AxisBase axis)
        {
            //adding in dictionary the +ve key
            defaultAxes.Add(axis.axisName + "pKey", (int)axis.positiveKey);

            //adding in dictionary the -ve key
            defaultAxes.Add(axis.axisName + "nKey", (int)axis.negativeKey);
        }
コード例 #2
0
        private void FixedUpdate()
        {
            for (int i = 0; i < Axes.Count; i++)
            {
                EIU_AxisBase a = Axes[i];
                a.negative = Input.GetKey(a.negativeKey);
                a.positive = Input.GetKey(a.positiveKey);

                a.targetAxis = (a.negative) ? -1 : (a.positive) ? 1 : 0;

                a.axis = Mathf.MoveTowards(a.axis, a.targetAxis, Time.deltaTime * a.sensitivity);
            }
        }
コード例 #3
0
        EIU_AxisBase ReturnAxis(string name)
        {
            EIU_AxisBase val = null;

            for (int i = 0; i < Axes.Count; i++)
            {
                if (string.Equals(name, Axes[i].axisName))
                {
                    val = Axes[i];
                }
            }
            return(val);
        }
コード例 #4
0
        void LoadAllAxes()
        {
            for (int i = 0; i < Axes.Count; i++)
            {
                EIU_AxisBase a = Axes[i];

                //retrieving in the form of integer
                int p = PlayerPrefs.GetInt(a.axisName + "pKey");
                int n = PlayerPrefs.GetInt(a.axisName + "nKey");

                //BUT loading in the form of KeyCode
                a.positiveKey = (KeyCode)p;
                a.negativeKey = (KeyCode)n;
            }
        }
コード例 #5
0
        public void OpenRebindButtonDialog(string axisName, bool negative)
        {
            targetAxis = ReturnAxis(axisName);
            rebinding  = true;

            if (!negative)
            {
                rebBtn.init(targetAxis.pKeyDescription);
            }
            else
            {
                rebBtn.init(targetAxis.nKeyDescription);
            }

            rebBtn.gameObject.SetActive(true);
            negativeKey = negative;
        }
コード例 #6
0
        public void ChangeInputKey(string name, KeyCode newKey, bool negative = false)
        {
            EIU_AxisBase a = ReturnAxis(name);

            if (a == null)
            {
                Debug.Log("Doesn't exist!");
                return;
            }

            if (negative)
            {
                a.negativeKey = newKey;
                a.nUIButton.ChangeKeyText(a.negativeKey.ToString());
            }
            else
            {
                a.positiveKey = newKey;
                a.pUIButton.ChangeKeyText(a.positiveKey.ToString());
            }
            SaveAxis(a);
        }
コード例 #7
0
 void SaveAxis(EIU_AxisBase axis)
 {
     PlayerPrefs.SetInt(axis.axisName + "pKey", (int)axis.positiveKey);
     PlayerPrefs.SetInt(axis.axisName + "nKey", (int)axis.negativeKey);
 }