コード例 #1
0
ファイル: InputManager.cs プロジェクト: SAlexeyG/Job
    public void Tick()
    {
        if (IsEnabled)
        {
            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                OnLeft?.Invoke();
            }
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                OnRight?.Invoke();
            }
            if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                OnUp?.Invoke();
            }

            if (Time.time - previousTime >
                (Input.GetKey(KeyCode.DownArrow) ? fallTime / 10 : fallTime))
            {
                OnDown?.Invoke();
                previousTime = Time.time;
            }
        }
    }
コード例 #2
0
ファイル: ModuleScript.cs プロジェクト: Emik03/Updog
 /// <summary>
 /// Assigns all events to the selectable, since there are so many of them.
 /// </summary>
 /// <param name="selectable">The selectable to assign events to.</param>
 /// <param name="i">The index of the methods array.</param>
 /// <param name="j">The number to pass into the method.</param>
 private void AssignSelectable(KMSelectable selectable, ref int i, ref int j)
 {
     if (OnCancel != null && i < OnCancel.Length)
     {
         selectable.OnCancel += OnCancel[i](j);
     }
     if (OnDefocus != null && i < OnDefocus.Length)
     {
         selectable.OnDefocus += OnDefocus[i](j);
     }
     if (OnDeselect != null && i < OnDeselect.Length)
     {
         selectable.OnDeselect += OnDeselect[i](j);
     }
     if (OnFocus != null && i < OnFocus.Length)
     {
         selectable.OnFocus += OnFocus[i](j);
     }
     if (OnHighlight != null && i < OnHighlight.Length)
     {
         selectable.OnHighlight += OnHighlight[i](j);
     }
     if (OnHighlightEnded != null && i < OnHighlightEnded.Length)
     {
         selectable.OnHighlightEnded += OnHighlightEnded[i](j);
     }
     if (OnInteract != null && i < OnInteract.Length)
     {
         selectable.OnInteract += OnInteract[i](j);
     }
     if (OnInteractEnded != null && i < OnInteractEnded.Length)
     {
         selectable.OnInteractEnded += OnInteractEnded[i](j);
     }
     if (OnLeft != null && i < OnLeft.Length)
     {
         selectable.OnLeft += OnLeft[i](j);
     }
     if (OnRight != null && i < OnRight.Length)
     {
         selectable.OnRight += OnRight[i](j);
     }
     if (OnSelect != null && i < OnSelect.Length)
     {
         selectable.OnSelect += OnSelect[i](j);
     }
 }
コード例 #3
0
 public void SwitchToRight()
 {
     if (CurrentState == States.Right)
     {
         return;
     }
     CurrentState = States.Right;
     OnRight?.Invoke();
     Animator.Play("SwitchToRight");
 }
コード例 #4
0
ファイル: Edge.cs プロジェクト: foxor/LD41
    public IEnumerator Activate(object value = null, bool leftSide = true)
    {
        this.value = value;
        IsActive   = true;

        if (leftSide)
        {
            if (OnRight != null)
            {
                yield return(OnRight.Activate(value, false));
            }
        }
        else
        {
            yield return(Pair.Activate());
        }

        IsActive   = false;
        this.value = null;
    }
コード例 #5
0
ファイル: InputManager.cs プロジェクト: SAlexeyG/Tetris
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            OnLeft?.Invoke();
        }
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            OnRight?.Invoke();
        }
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            OnUp?.Invoke();
        }

        if (Time.time - previousTime >
            (Input.GetKey(KeyCode.DownArrow) ? fallTime / 10 : fallTime))
        {
            OnDown?.Invoke();
            previousTime = Time.time;
        }
    }
コード例 #6
0
    private void Update()
    {
        if (Input.GetButtonDown("Vertical"))
        {
            float axisVertical = Input.GetAxisRaw("Vertical");

            if (axisVertical == 1)
            {
                OnUp?.Invoke();
                return;
            }

            if (axisVertical == -1)
            {
                OnDown?.Invoke();
                return;
            }
        }

        if (Input.GetButtonDown("Horizontal"))
        {
            float axisHorizontal = Input.GetAxisRaw("Horizontal");

            if (axisHorizontal == -1)
            {
                OnLeft?.Invoke();
                return;
            }

            if (axisHorizontal == 1)
            {
                OnRight?.Invoke();
                return;
            }
        }
    }
コード例 #7
0
ファイル: Controller.cs プロジェクト: SeanI115/BulletHellGame
 private void _OnRight()
 {
     OnRight?.Invoke(this, EventArgs.Empty);
 }
コード例 #8
0
 protected void Right()
 {
     OnRight?.Invoke(this);
 }
コード例 #9
0
 public void RightAction()
 {
     OnRight?.Invoke();
 }
コード例 #10
0
    public void InputPass()
    {
        // Get Input
        float y = 0;
        float x = 0;

        if (_useAxis)
        {
            y = Input.GetAxisRaw("Horizontal");
            x = Input.GetAxisRaw("Vertical");
        }
        else
        {
            if (Input.GetButtonDown("Fire_A"))
            {
                x--;
            }
            if (Input.GetButtonDown("Fire_B"))
            {
                y++;
            }
            if (Input.GetButtonDown("Fire_X"))
            {
                y--;
            }
            if (Input.GetButtonDown("Fire_Y"))
            {
                x++;
            }
        }

        if (_lastX != x || _lastY != y)
        {
            // Debug.Log($"x : {x} - y : {y}");
            _lastY = y;
            _lastX = x;
        }

        // Check Up
        if (!_validated[(int)VirtualNote.Up] && x > _validationThreshold)
        {
            _validated[(int)VirtualNote.Up] = true;
            OnUp?.Invoke();
            OnHammerHit?.Invoke();
            OnUpUnity?.Invoke();
            // Debug.Log("Up");
        }
        if (!_validated[(int)VirtualNote.Right] && y > _validationThreshold)
        {
            _validated[(int)VirtualNote.Right] = true;
            OnRight?.Invoke();
            OnHammerHit?.Invoke();
            OnRightUnity?.Invoke();
            // Debug.Log("Right");
        }
        if (!_validated[(int)VirtualNote.Down] && x < _validationThreshold * -1)
        {
            _validated[(int)VirtualNote.Down] = true;
            OnDown?.Invoke();
            OnHammerHit?.Invoke();
            OnDownUnity?.Invoke();
            // Debug.Log("Down");
        }
        if (!_validated[(int)VirtualNote.Left] && y < _validationThreshold * -1)
        {
            _validated[(int)VirtualNote.Left] = true;
            OnLeft?.Invoke();
            OnHammerHit?.Invoke();
            OnLeftUnity?.Invoke();
            // Debug.Log("Left");
        }

        // Check disabled
        if ((_validated[(int)VirtualNote.Up] || _validated[(int)VirtualNote.Down]) && Mathf.Abs(x) <= _disableThreshold)
        {
            _validated[(int)VirtualNote.Up]   = false;
            _validated[(int)VirtualNote.Down] = false;
        }
        if ((_validated[(int)VirtualNote.Right] || _validated[(int)VirtualNote.Left]) && Mathf.Abs(y) <= _disableThreshold)
        {
            _validated[(int)VirtualNote.Right] = false;
            _validated[(int)VirtualNote.Left]  = false;
        }
    }
コード例 #11
0
ファイル: MainPage.xaml.cs プロジェクト: OttyLab/BTBulldozer
 private async void OnRightClicked(object sender, EventArgs e)
 {
     await OnRight?.Invoke(sender, e);
 }
コード例 #12
0
 public void Right(float proc)
 {
     isRight = true;
     physical?.AddForward(proc);
     OnRight?.Invoke(proc);
 }