private void Start() { contDect = GetComponent <ControllerDetection>(); standAloneInputMod = GameObject.FindGameObjectWithTag("MainMenuEventSys").GetComponent <StandaloneInputModule>(); startInputMod = standAloneInputMod; currentButton = EventSystem.current.firstSelectedGameObject; }
void Awake() { anim = gameObject.GetComponent <Animator>(); score = gameObject.GetComponent <PlayerScore>(); controllerDet = Camera.main.GetComponent <ControllerDetection>(); pickupTextController.SetActive(false); pickupTextKeyboard.SetActive(false); }
private void Awake() { pickupCounters = GameObject.FindGameObjectWithTag("Pickup Counter").GetComponent <PickupCounter>(); contDetect = GetComponentInChildren <ControllerDetection>(); gameOverText.SetActive(false); winText.SetActive(false); loseText.SetActive(false); playAgainButton.SetActive(false); quitButton.SetActive(false); }
void Awake() { ctlrDetection = new ControllerDetection(this); int i = 0; foreach (Player p in ReInput.players.Players) { players[i] = p; i++; } }
// Use this for initialization void Start() { ControllerDetection controllerDetection = GameObject.Find("Playermanager").GetComponent <ControllerDetection>(); comPort = controllerDetection.spieler1; //comPort = "COM3"; Destroy(controllerDetection.gameObject); stream = new SerialPort(comPort, 115200); stream.Open();//Open the serial Stream Debug.Log("Serial Port was opened"); }
private void Awake() { if (!instance) { instance = this; } else { Destroy(gameObject); } _input = new PlayerInput(); _input.Player.ControllerDetect.performed += ctx => ControllerDetected(); _input.Player.KeyboardDetect.performed += ctx => KeyboardDetected(); }
private void Initialize() { if (_controllerActivity == null) { _suspension = new BehaviorSubject <bool>(!enabled); // IObservable<ButtonEvent> keyboardActivity = gameObject.AddComponent<KeyboardPoller>().ButtonEvents; // IObservable<Controller?> keyboardSelection = keyboardActivity // .Where(e => e == ButtonEvent.Down) // .Select(e => (Controller?)null); IObservable <Controller?> controllerSelection = ControllerDetection.ActiveJoystick() .Select <ControllerDetection.NamedControllerId, Controller?>( namedControllerId => { var id = namedControllerId.ControllerId; var name = namedControllerId.Name; if (id is ControllerId.XInput) { return(new Controller(ControllerType.Xbox360, id, Maybe.Nothing <UnityInputDeviceProfile>(), name)); } var inputDeviceProfile = Controllers.UnityIdToDeviceProfile(namedControllerId.Name); var controllerType = Controllers.UnityIdToControllerType(namedControllerId.Name); return(new Controller(controllerType, namedControllerId.ControllerId, inputDeviceProfile, name)); }); Controller?keyboardPeripheral = null; var deviceSelection = controllerSelection .DistinctUntilChanged(EqualityComparer <Controller?> .Default) .Suspenable(_suspension) // Initially there is no controller active // so we report that .StartWith(keyboardPeripheral) .Replay(1); _subscription = deviceSelection.Connect(); _controllerActivity = deviceSelection .DistinctUntilChanged(EqualityComparer <Controller?> .Default); _controllerActivity.Subscribe(controller => { Debug.Log("Controller " + controller + " activated"); }); } }