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; } } }
public void Ini() { if (Initialize) { return; } Initialize = true; _menu = GetComponent <Menu>(); if (DisableOnEnter) { _menu.onEnter.AddListener(() => _menu.SetActiveGO(false)); } if (OnEntered) { _menu.waitEnterAnimationEnd = true; OnEntered.RegisterListener(this); } if (OnEnter) { _menu.onEnter.AddListener(OnEnter.Raise); } if (OnLeft) { OnLeft.RegisterListener(this); _menu.waitLeaveAnimationEnd = true; } if (OnLeave) { _menu.onLeave.AddListener(OnLeave.Raise); } }
/// <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); } }
public static void Create(int port, GetData gd, OnJoin join, OnLeft left) { connects = new Dictionary<ushort, TcpClientm>(); Socket = new TcpListener(IPAddress.Any, port); _gd = gd; _join = join; _left = left; }
private void OnDestroy() { if (OnEntered) { OnEntered.UnregisterListener(this); } if (OnLeft) { OnLeft.UnregisterListener(this); } }
/// <summary> /// Checks Collision between ball and player slider /// </summary> /// <param name="ball">Ball ball</param> public void Collision(Ball ball) { if (ball.CollisionBox.Intersects(slider.CollisionBox)) { float width = ball.MoveVector.X > 0 ? -ball.CollisionBox.Width : ball.CollisionBox.Width; //prevents the ball from stucking in a slider ball.Position = new Vector2(slider.CollisionBox.X + width, ball.Position.Y); Vector2 sideVec = slider.GetSideVector(ball.CollisionBox); ball.ChangeMoveVector((ball.MoveVector * -1) + (slider.MoveVector / 2) + sideVec); } if (ball.CollisionBox.Intersects(endZone)) //ball out of field { OnLeft?.Invoke(this, EventArgs.Empty); } }
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; } }
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; } } }
private void _OnLeft() { OnLeft?.Invoke(this, EventArgs.Empty); }
protected void Left() { OnLeft?.Invoke(this); }
public void LeftAction() { OnLeft?.Invoke(); }
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; } }
private async void OnLeftClicked(object sender, EventArgs e) { await OnLeft?.Invoke(sender, e); }
public void Left(float proc) { isLeft = true; physical?.AddForward(proc); OnLeft?.Invoke(proc); }