Ejemplo n.º 1
0
 private void OnButtonRelease(int buttonId)
 {
     ButtonReleased?.Invoke(this, new ButtonPressedEventArgs()
     {
         ButtonId = buttonId, Device = null
     });
 }
Ejemplo n.º 2
0
 protected void InvokeButtonReleased(EControllerID controllerID, EInputButton inputButton)
 {
     if (ButtonReleased != null)
     {
         ButtonReleased.Invoke(controllerID, inputButton);
     }
 }
Ejemplo n.º 3
0
    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>();
    }
Ejemplo n.º 4
0
 private void OnKeyRelease(KeyInfo info)
 {
     if (keyMappings.ContainsKey(info.KeyCode) && ButtonReleased != null)
     {
         ButtonReleased.Invoke(keyMappings[info.KeyCode]);
     }
 }
Ejemplo n.º 5
0
 public void ResetSwitch()
 {
     if (!isSwitch || pressedCount > 0)
     {
         return;
     }
     ButtonReleased.Invoke();
 }
Ejemplo n.º 6
0
 private void OnTriggerExit2D(Collider2D other)
 {
     if (--pressedCount != 0 || isSwitch)
     {
         return;
     }
     ButtonReleased.Invoke();
     anim.SetBool("pressed", false);
 }
Ejemplo n.º 7
0
    void Start()
    {
        buttonReleaseScript = GameObject.Find("ButtonRelease").GetComponent<ButtonReleased>();
        smObj = GameObject.Find("SoundManager");

        if(smObj != null)
        {
            smScript = smObj.GetComponent<SoundManager>();
        }
    }
Ejemplo n.º 8
0
 private void InDevOnNoteOn(NoteOnMessage msg)
 {
     if (msg.Velocity == 0)
     {
         ButtonReleased?.Invoke(new ButtonReleasedEventArgs(PitchToButton(msg.Pitch)));
     }
     else
     {
         ButtonPressed?.Invoke(new ButtonPressedEventArgs(PitchToButton(msg.Pitch)));
     }
 }
Ejemplo n.º 9
0
 private void Pin_ValueChanged(object sender, GpioPinValueChangedEventArgs e)
 {
     if (e.Edge == GpioPinEdge.RisingEdge)
     {
         ButtonPressed?.Invoke();
     }
     else
     {
         ButtonReleased?.Invoke();
     }
 }
Ejemplo n.º 10
0
 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();
 }
Ejemplo n.º 11
0
 private void _buttonPin_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args)
 {
     if (args.Edge == GpioPinEdge.FallingEdge)
     {
         ButtonPressed?.Invoke(this, DateTime.Now);
     }
     else
     {
         ButtonReleased?.Invoke(this, DateTime.Now);
     }
 }
Ejemplo n.º 12
0
        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);
                }
            }
        }
Ejemplo n.º 13
0
        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);
                }
            }
        }
Ejemplo n.º 14
0
    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++;
    }
Ejemplo n.º 15
0
 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(); });
     }
 }
Ejemplo n.º 16
0
        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);
            }
        }
Ejemplo n.º 17
0
        /// <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;
        }
Ejemplo n.º 18
0
        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);
            });
        }
Ejemplo n.º 19
0
    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;
            }
        }
    }
Ejemplo n.º 20
0
 void Start()
 {
     buttonReleaseScript = GameObject.Find("ButtonRelease").GetComponent<ButtonReleased>();
 }
Ejemplo n.º 21
0
 /// <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);
Ejemplo n.º 22
0
    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);
    }
Ejemplo n.º 23
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);
Ejemplo n.º 25
0
 /// <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);
Ejemplo n.º 26
0
 protected virtual void OnButtonReleased(JoystickEventArgs e)
 {
     ButtonReleased?.Invoke(this, e);
 }