private void OnButtonRelease(int buttonId) { ButtonReleased?.Invoke(this, new ButtonPressedEventArgs() { ButtonId = buttonId, Device = null }); }
protected void InvokeButtonReleased(EControllerID controllerID, EInputButton inputButton) { if (ButtonReleased != null) { ButtonReleased.Invoke(controllerID, inputButton); } }
void Start() { buttonReleaseScript = GameObject.Find("ButtonRelease").GetComponent<ButtonReleased>(); inGameUI = GameObject.Find("InGameUIManager").GetComponent<InGameUIManager>(); nappyPadSpawnerObj = GameObject.Find("NappyPadSpawner"); if(nappyPadSpawnerObj != null) { nappyPadSpawnerScript = nappyPadSpawnerObj.GetComponent<NappyPadSpawner>(); } nappyPadSpawnerScript.nappyPadCount++; if(!inGameUI.firstNappy) { if(inGameUI.isLevel1) { inGameUI.Enable("PlayerButtonTutorialLabel5"); inGameUI.Enable("LeftArrow"); inGameUI.firstNappy = true; } } sm = GameObject.Find("SoundManager").GetComponent<SoundManager>(); }
private void OnKeyRelease(KeyInfo info) { if (keyMappings.ContainsKey(info.KeyCode) && ButtonReleased != null) { ButtonReleased.Invoke(keyMappings[info.KeyCode]); } }
public void ResetSwitch() { if (!isSwitch || pressedCount > 0) { return; } ButtonReleased.Invoke(); }
private void OnTriggerExit2D(Collider2D other) { if (--pressedCount != 0 || isSwitch) { return; } ButtonReleased.Invoke(); anim.SetBool("pressed", false); }
void Start() { buttonReleaseScript = GameObject.Find("ButtonRelease").GetComponent<ButtonReleased>(); smObj = GameObject.Find("SoundManager"); if(smObj != null) { smScript = smObj.GetComponent<SoundManager>(); } }
private void InDevOnNoteOn(NoteOnMessage msg) { if (msg.Velocity == 0) { ButtonReleased?.Invoke(new ButtonReleasedEventArgs(PitchToButton(msg.Pitch))); } else { ButtonPressed?.Invoke(new ButtonPressedEventArgs(PitchToButton(msg.Pitch))); } }
private void Pin_ValueChanged(object sender, GpioPinValueChangedEventArgs e) { if (e.Edge == GpioPinEdge.RisingEdge) { ButtonPressed?.Invoke(); } else { ButtonReleased?.Invoke(); } }
void Start() { buttonReleaseScript = GameObject.Find("ButtonRelease").GetComponent<ButtonReleased>(); enemySpawner = GameObject.Find("EnemySpawner").GetComponent<EnemySpawner>(); GetComponent<Animation>().CrossFade("Mooing"); IdleState(); sm = GameObject.Find("SoundManager").GetComponent<SoundManager>(); spawn.timer = timer; spawnLocation = this.transform.position; StartBottles(); }
private void _buttonPin_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args) { if (args.Edge == GpioPinEdge.FallingEdge) { ButtonPressed?.Invoke(this, DateTime.Now); } else { ButtonReleased?.Invoke(this, DateTime.Now); } }
private void OnButtonReleased(uint index) { if (m_buttonToControllerInput.TryGetValue((int)index, out ControllerInput input)) { var list = m_buttons[input]; bool wasDown = list.Count > 0; list.Remove(index); if (wasDown && list.Count == 0) { ButtonReleased?.Invoke(input); } } }
protected virtual void OnKeyReleased(KeyCode key) { if (m_keyToControllerInput.TryGetValue(key, out ControllerInput input)) { var list = m_buttons[input]; bool wasDown = list.Count > 0; list.Remove(key); if (wasDown && list.Count == 0) { ButtonReleased?.Invoke(input); } } }
void Start() { bottles = GameObject.Find("BottlesSpawner").GetComponent<BottlesSpawner>(); buttonReleaseScript = GameObject.Find("ButtonRelease").GetComponent<ButtonReleased>(); inGameUI = GameObject.Find("InGameUIManager").GetComponent<InGameUIManager>(); menuButtonScript = GameObject.Find("UIPanel").GetComponent<MenuButton>(); sm = GameObject.Find("SoundManager").GetComponent<SoundManager>(); inGameUI.PF_Bottle = this.gameObject; if(!bottles.firstTimeBottleClicked && inGameUI.isLevel1) { inGameUI.Enable("5. CollectBottles"); bottles.firstTimeBottleClicked = true; } //pbm.totalBottles++; }
protected override void Update() { base.Update(); if (GameObject.FindWithTag("Player").GetComponent <Character>().Airborne == true) { //ButtonPressedFirstTime.RemoveAllListeners(); ButtonPressedFirstTime.AddListener(delegate { this.GetComponentInParent <InputManager>().GlideButtonDown(); }); ButtonReleased.AddListener(delegate { this.GetComponentInParent <InputManager>().GlideButtonUp(); }); ButtonPressed.AddListener(delegate { this.GetComponentInParent <InputManager>().GlideButtonPressed(); }); } else { //ButtonPressedFirstTime.RemoveAllListeners(); ButtonPressedFirstTime.AddListener(delegate { this.GetComponentInParent <InputManager>().RunButtonDown(); }); ButtonReleased.AddListener(delegate { this.GetComponentInParent <InputManager>().RunButtonUp(); }); ButtonPressed.AddListener(delegate { this.GetComponentInParent <InputManager>().RunButtonPressed(); }); } }
internal void HandleInputEvent(uint buttonIndex, uint newState) { var info = new ButtonInfo() { DeviceIndex = DeviceIndex, Button = buttonIndex, }; buttonStates[buttonIndex] = newState; if (newState == 1) { ButtonPressed?.Invoke(buttonIndex); Host.ButtonPressed(info); } else { ButtonReleased?.Invoke(buttonIndex); Host.ButtonReleased(info); } }
/// <summary> /// Event listner for timer in controller /// </summary> /// <param name="sender">Event invoker</param> /// <param name="e">Event arguments</param> internal void TimerOnElapsed(object sender, ElapsedEventArgs e) { if (IsButtonPressed && !lastButtonState_) { buttonTimer_.Reset(); buttonTimer_.Start(); ButtonPressed?.Invoke(this, EventArgs.Empty); } else if (!IsButtonPressed && lastButtonState_) { buttonTimer_.Stop(); ButtonReleased?.Invoke(this, new ButtonReleasedEventArgs(buttonTimer_.Elapsed.TotalMilliseconds < parent_.HoldMinTime ? ButtonState.Clicked : ButtonState.Holded)); } lastButtonState_ = IsButtonPressed; }
public CallButtonService(ILogger <CallButtonService> logger, HubConnection hubConnection) { _logger = logger; _hubConnection = hubConnection; _hubConnection.Closed += async(exception) => { if (exception != null) { _logger.LogError(exception, "Connection unexpectedly."); await Task.Delay(new Random().Next(0, 5) * 1000).ConfigureAwait(false); try { await _hubConnection.StartAsync().ConfigureAwait(false); _logger.LogInformation("Connection restarted."); } catch (Exception exc) { _logger.LogError(exc, "Failed to restart connection."); } } }; pressedSubscription = _hubConnection.On <string>("ButtonPressed", _ => { ButtonPressed?.Invoke(this, EventArgs.Empty); }); releasedSubscription = _hubConnection.On <string>("ButtonReleased", _ => { ButtonReleased?.Invoke(this, EventArgs.Empty); }); }
void Start() { buttonReleaseScript = GameObject.Find("ButtonRelease").GetComponent<ButtonReleased>(); enemyObj = GameObject.FindGameObjectWithTag("Enemy"); if(enemyObj != null) { enemyScript = enemyObj.GetComponent<Enemy>(); } sm = GameObject.Find("SoundManager").GetComponent<SoundManager>(); playerSpawn = FindObjectOfType<PlayerSpawn>(); if(attackingUnit) { switch(gameObject.name) { case "PF_TomatoBaby(Clone)" : weaponSound = sm.tomatoHittingEnemy; break; case "PF_BroccoliBaby(Clone)" : weaponSound = sm.broccoliHittingEnemy; break; case "PF_CarrotBaby(Clone)" : weaponSound = sm.carrotHittingEnemy; break; case "PF_OnionBaby(Clone)" : weaponSound = sm.onionHittingEnemy; break; } } }
void Start() { buttonReleaseScript = GameObject.Find("ButtonRelease").GetComponent<ButtonReleased>(); }
/// <summary> /// Raises the <see cref="ButtonReleased"/> event. /// </summary> /// <param name="window">The window in which the input event took place.</param> /// <param name="button">The mouse button that was released.</param> protected virtual void OnButtonReleased(IUltravioletWindow window, MouseButton button) => ButtonReleased?.Invoke(window, this, button);
void Start() { attackDelay = false; bottles = GameObject.Find("BottlesSpawner").GetComponent<BottlesSpawner>(); buttonReleaseScript = GameObject.Find("ButtonRelease").GetComponent<ButtonReleased>(); enemySpawner = GameObject.Find("EnemySpawner").GetComponent<EnemySpawner>(); gameOverObj = GameObject.FindGameObjectWithTag("GO"); gameSpawnScript = GameObject.Find("GameSpawner").GetComponent<GameSpawner>(); inGameUI = GameObject.Find("InGameUIManager").GetComponent<InGameUIManager>(); killed = false; nappyPad = GameObject.Find("NappyPadSpawner").GetComponent<NappyPadSpawner>().PF_NappyPad; nappyPadObj = GameObject.FindGameObjectWithTag("Ammo"); if(nappyPadObj != null) { nappyPadScript = nappyPadObj.GetComponent<NappyPad>(); } nappyPadShadow = GameObject.Find("NappyPadSpawner").GetComponent<NappyPadSpawner>().PF_NappyPadShadow; playerSpawn = GameObject.FindGameObjectWithTag("SpawnBlock").GetComponent<PlayerSpawn>(); sm = GameObject.Find("SoundManager").GetComponent<SoundManager>(); laugh = sm.laugh; SetState(0); }
private void OnButtonReleased(Buttons button) { ButtonReleased?.Invoke(this, new GamepadButtonEventArgs(button)); }
/// <summary> /// Raises the <see cref="ButtonReleased"/> event. /// </summary> /// <param name="window">The window that raised the event.</param> /// <param name="scancode">The <see cref="Scancode"/> that represents the button that was released.</param> protected virtual void OnButtonReleased(IUltravioletWindow window, Scancode scancode) => ButtonReleased?.Invoke(window, this, scancode);
/// <summary> /// Raises the <see cref="ButtonReleased"/> event. /// </summary> /// <param name="button">The <see cref="GamePadButton"/> value that represents the button that was pressed.</param> protected virtual void OnButtonReleased(GamePadButton button) => ButtonReleased?.Invoke(this, button);
protected virtual void OnButtonReleased(JoystickEventArgs e) { ButtonReleased?.Invoke(this, e); }