public void Update()
        {
            // Update Axes

            {
                for (int axisIndex = 0; axisIndex < m_AxesKeys.Count; ++axisIndex)
                {
                    int key = m_AxesKeys[axisIndex];
                    AxisServerController serverController = null;
                    if (m_Axes.TryGetValue(key, out serverController))
                    {
                        float value = serverController.GetValue();
                        m_AxesData[key].value = value;
                    }
                }
            }

            // Update Buttons

            {
                for (int buttonIndex = 0; buttonIndex < m_ButtonsKeys.Count; ++buttonIndex)
                {
                    int key = m_ButtonsKeys[buttonIndex];
                    ButtonServerController serverController = null;
                    if (m_Buttons.TryGetValue(key, out serverController))
                    {
                        bool newValue = serverController.GetButton();
                        m_ButtonsData[key].value = newValue;
                    }
                }
            }
        }
        public void AddAxis(int i_ControlId, AxisServerController i_Controller)
        {
            if (!m_Axes.ContainsKey(i_ControlId))
            {
                m_Axes.Add(i_ControlId, i_Controller);
                m_AxesKeys.Add(i_ControlId);

                m_AxesData.Add(i_ControlId, new WiFiAxisData());

                m_Controllers.Add(i_Controller);
            }
        }
Example #3
0
        private void InternalAddAxis(WiFiControlDescriptor i_Descriptor)
        {
            string controlName = i_Descriptor.controlName;

            for (int playerIndex = 0; playerIndex < m_Players.Count; ++playerIndex)
            {
                WiFiPlayerInput playerInput = m_Players[playerIndex];
                if (playerInput != null)
                {
                    AxisServerController axisServerController = new AxisServerController(controlName, (PLAYER_NUMBER)playerIndex);
                    playerInput.AddAxis(controlName, axisServerController);
                }
            }
        }
        // Axes

        public void AddAxis(string i_ControlName, AxisServerController i_Controller)
        {
            int hash = StringUtils.GetHashCode(i_ControlName);

            AddAxis(hash, i_Controller);
        }