void Update() { if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) { CalculateTouchPosition(); OnTouchDown?.Invoke(pos, targetRotation); } }
public async void FireOnTouchDown() { if (OnTouchDown != null) { OnTouchDown.Invoke("TouchDown", new System.EventArgs()); } await this.ScaleTo(0.95, 50); }
public void OnPointerDown(PointerEventData eventData) { time = 0; clicked = true; draging = false; OnTouchDown?.Invoke(); }
internal void TouchDown() { _touchDownPosition = _touchPosition; if (OnTouchDown == null) { return; } OnTouchDown.Invoke(TouchPosition); }
private void TriggerTouchDown() { _frameTouchData.DownPosition = _frameTouchData.CurrentPosition; _frameTouchData.DownOverUI = _frameTouchData.CurrentlyOverUI; OnTouchDown?.Invoke(_frameTouchData); if (debugEvents) { Debug.Log("[DragCameraController]: Touch Down Triggered"); } }
private void OnCollisionEnter2D(Collision2D other) { var touchGround = other.transform.CompareTag("Ground"); if (other.transform.CompareTag("House") || _level == 0 && touchGround) { OnTouchDown?.Invoke(); } if (_level > 0 && touchGround) { GameManager.CallGameOver(); } }
public void OnPointerDown(PointerEventData eventData) { if (_eventType != EventType.TOUCH) { return; } if (true != CheckCanClick()) { return; } _timeWaitNextClick = _clickInterval; _isTouchDown = true; PlayTouchSound(); PlayTouchAnim(() => { OnTouchDown.Invoke(eventData); OnAnimDone.Invoke(); }); }
void Update_Idle() { if (!HasActiveTouch()) { return; } if (_input.GetTouchCount() == 1 && _input.GetTouchPhase(0) == TouchPhase.Began) { _state = State.kTouchDown; _curPos = _input.GetTouchPosition(0); _momentum = Vector2.zero; if (TouchDownHandler != null) { TouchDownHandler.Invoke(); } } }
protected virtual void Update() { StartCoroutine(CheckGameObjectTouched()); if (canCheckPlayerDistance) { #if UNITY_EDITOR if (player.GetComponent <IrisMovementPC>().TargetReached) { OnTouchDown.Invoke(); canCheckPlayerDistance = false; } #elif UNITY_ANDROID if (player.GetComponent <IrisMovement>().TargetReached) { OnTouchDown.Invoke(); canCheckPlayerDistance = false; } #endif } }
public void OnPointerDown(PointerEventData eventData) { if (_eventType != EventType.TOUCH) { return; } if (!IsTouchEnabled()) { return; } if (!CheckCanClickByInterval()) { return; } _timeWaitNextClick = _clickInterval; if (null != _stateSelectedSprite) { if (null != _stateDefaultImage) { _stateDefaultSprite = _stateDefaultImage.sprite; _stateDefaultImage.sprite = _stateSelectedSprite; } else if (null != _stateDefaultSpriteRenderer) { _stateDefaultSprite = _stateDefaultSpriteRenderer.sprite; _stateDefaultSpriteRenderer.sprite = _stateSelectedSprite; } } TouchDown(eventData); OnTouchDown.Invoke(); PlayClickSound(); PlayClickVO(); PlayTouchAnim(() => { OnAnimDone.Invoke(); }); }
private void CheckGesturesEditor() { if (Input.GetMouseButtonDown(0)) { Vector2 mousePos = Input.mousePosition; _lastMousePos = mousePos; _touchDownPos = mousePos; OnTouchDown?.Invoke(mousePos); } if (Input.GetMouseButton(0)) { Vector2 mousePos = Input.mousePosition; _touchDelta = mousePos - _lastMousePos; _scaledTouchDelta = new Vector2(_touchDelta.x / Screen.width, _touchDelta.y / Screen.height); _lastMousePos = mousePos; float _horizontalAxis = mousePos.x - _touchDownPos.x; float _verticalAxis = mousePos.y - _touchDownPos.y; _axis = new Vector2(_horizontalAxis, _verticalAxis).normalized; } else { _touchDelta = Vector2.zero; _scaledTouchDelta = Vector2.zero; _axis = Vector2.zero; } if (Input.GetMouseButtonUp(0)) { OnTouchUp?.Invoke(Input.mousePosition); } }
private void CheckGesturesMobile() { if (Input.touchCount > 0) { Touch touch = Input.GetTouch(0); if (touch.phase == TouchPhase.Began) { _touchDownPos = touch.position; OnTouchDown?.Invoke(touch.position); } if (touch.phase == TouchPhase.Moved) { Vector2 dragDistanceUnscaled = touch.deltaPosition; _scaledTouchDelta = new Vector2(dragDistanceUnscaled.x / Screen.width, dragDistanceUnscaled.y / Screen.height); float _horizontalAxis = touch.position.x - _touchDownPos.x; float _verticalAxis = touch.position.y - _touchDownPos.y; _axis = new Vector2(_horizontalAxis, _verticalAxis).normalized; } if (touch.phase == TouchPhase.Ended) { OnTouchUp.Invoke(touch.position); } } else { _touchDelta = Vector2.zero; _scaledTouchDelta = Vector2.zero; _axis = Vector2.zero; } }
public void HitTheGround(Entity entity) { Self = new Player(entity); Client.PlayerData.Pos = entity.Status.Position; OnTouchDown?.Invoke(); }
public void FireOnTouchDown(Client client) { OnTouchDown?.Invoke(client); }
private void InvokeOnTouchDown(SInputTouch touch) { OnTouchDown?.Invoke(touch); }
private void OnDown() { OnTouchDown?.Invoke(this); }
public virtual void OnPointerDown(PointerEventData eventData) { OnTouchDown?.Invoke(); }