private void AssignJoysticksToPlayers() { IList <Joystick> joysticks = ReInput.get_controllers().get_Joysticks(); for (int index = 0; index < ((ICollection <Joystick>)joysticks).Count; ++index) { Joystick joystick = joysticks[index]; if (!ReInput.get_controllers().IsControllerAssigned(((Controller)joystick).get_type(), (int)((Controller)joystick).id) && ((Controller)joystick).GetAnyButtonDown()) { ((Player.ControllerHelper) this.FindPlayerWithoutJoystick()?.controllers).AddController((Controller)joystick, false); } } if (!this.DoAllPlayersHaveJoysticks()) { return; } ReInput.get_configuration().set_autoAssignJoysticks(true); ((Behaviour)this).set_enabled(false); }