Beispiel #1
0
        void CreateVirtualAxes()
        {
            // set axes to use
            this.m_UseX = this.axesToUse == AxisOption.Both || this.axesToUse == AxisOption.OnlyHorizontal;
            this.m_UseY = this.axesToUse == AxisOption.Both || this.axesToUse == AxisOption.OnlyVertical;

            // create new axes based on axes to use
            if (this.m_UseX)
            {
                this.m_HorizontalVirtualAxis = new CrossPlatformInputManager.VirtualAxis(this.horizontalAxisName);
                CrossPlatformInputManager.RegisterVirtualAxis(this.m_HorizontalVirtualAxis);
            }

            if (this.m_UseY)
            {
                this.m_VerticalVirtualAxis = new CrossPlatformInputManager.VirtualAxis(this.verticalAxisName);
                CrossPlatformInputManager.RegisterVirtualAxis(this.m_VerticalVirtualAxis);
            }
        }
Beispiel #2
0
        public void RegisterVirtualAxis(CrossPlatformInputManager.VirtualAxis axis)
        {
            // check if we already have an axis with that name and log and error if we do
            if (this.m_VirtualAxes.ContainsKey(axis.name))
            {
                Debug.LogError("There is already a virtual axis named " + axis.name + " registered.");
            }
            else
            {
                // add any new axes
                this.m_VirtualAxes.Add(axis.name, axis);

                // if we dont want to match with the input manager setting then revert to always using UnityEngine; using UnityEditor; using virtual
                if (!axis.matchWithInputManager)
                {
                    this.m_AlwaysUseVirtual.Add(axis.name);
                }
            }
        }