Esempio n. 1
0
        private void Awake()
        {
            if (m_instance == null)
            {
                m_instance         = this;
                m_scanService      = new ScanService();
                m_schemeLookup     = new Dictionary <string, ControlScheme>();
                m_schemeLookupByID = new Dictionary <string, ControlScheme>();
                m_actionLookup     = new Dictionary <string, Dictionary <string, InputAction> >();

                Initialize();
                gamepad.Awake(this);

                // try and load custom runtime bindings
                Load();

                // Lock or unlock the cursor.
                // Cursor.lockState = m_LockCursor ? CursorLockMode.Locked : CursorLockMode.None;
                // Cursor.visible = !m_LockCursor;
            }
            else
            {
                Debug.LogWarning("You have multiple InputManager instances in the scene!", gameObject);
                Destroy(this);
            }
        }
Esempio n. 2
0
 void Awake()
 {
     m_schemeLookup = new Dictionary <string, ControlScheme>();
     playerSchemes  = new ControlScheme[numPlayers];
     ScanService.OnAwake();
     GamepadHandler.OnAwake();
 }
Esempio n. 3
0
        void Update()
        {
            float unscaledDeltaTime = Time.unscaledDeltaTime;

            GamepadHandler.OnUpdate(unscaledDeltaTime);
            for (int i = 0; i < m_controlSchemes.Count; i++)
            {
                m_controlSchemes[i].Update(unscaledDeltaTime);
            }
            ScanService.Update(Time.unscaledTime, KeyCode.Escape, 5.0f, numPlayers);
        }
Esempio n. 4
0
        protected override void Awake()
        {
            base.Awake();

            m_schemeLookup = new Dictionary <string, ControlScheme>();
            playerSchemes  = new ControlScheme[numPlayers];
            ScanService.OnAwake();
            GamepadHandler.OnAwake();

            // try and load custom runtime bindings
            if (!LoadCustomSchemes())
            {
                Debug.Log("Couldnt find custom control bindings, loading defaults...");
                LoadDefaultSchemes();
            }
        }
Esempio n. 5
0
        void Update()
        {
            float unscaledDeltaTime = Time.unscaledDeltaTime;

            GamepadHandler.OnUpdate(unscaledDeltaTime);

            updatedSchemes.Clear();
            for (int i = 0; i < playerSchemes.Length; i++)
            {
                if (playerSchemes[i] != null)
                {
                    if (!updatedSchemes.Contains(playerSchemes[i]))
                    {
                        playerSchemes[i].Update(unscaledDeltaTime);
                        updatedSchemes.Add(playerSchemes[i]);
                    }
                }
            }

            ScanService.Update(Time.unscaledTime, KeyCode.Escape, 5.0f, numPlayers);
        }