public void OnPointerDown(PointerEventData eventData)
    {
        time    = 0;
        clicked = true;
        draging = false;

        OnTouchDown?.Invoke();
    }
 public async void FireOnTouchDown()
 {
     if (OnTouchDown != null)
     {
         OnTouchDown.Invoke("TouchDown", new System.EventArgs());
     }
     await this.ScaleTo(0.95, 50);
 }
Пример #3
0
 void Update()
 {
     if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
     {
         CalculateTouchPosition();
         OnTouchDown?.Invoke(pos, targetRotation);
     }
 }
Пример #4
0
 internal void TouchDown()
 {
     _touchDownPosition = _touchPosition;
     if (OnTouchDown == null)
     {
         return;
     }
     OnTouchDown.Invoke(TouchPosition);
 }
Пример #5
0
    private void TriggerTouchDown()
    {
        _frameTouchData.DownPosition = _frameTouchData.CurrentPosition;
        _frameTouchData.DownOverUI   = _frameTouchData.CurrentlyOverUI;

        OnTouchDown?.Invoke(_frameTouchData);

        if (debugEvents)
        {
            Debug.Log("[DragCameraController]: Touch Down Triggered");
        }
    }
Пример #6
0
        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();
            }
        }
Пример #7
0
 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();
     });
 }
Пример #8
0
    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
        }
    }
Пример #9
0
    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;
            }
        }
Пример #12
0
 public void FireOnTouchDown(Client client)
 {
     OnTouchDown?.Invoke(client);
 }
Пример #13
0
 private void InvokeOnTouchDown(SInputTouch touch)
 {
     OnTouchDown?.Invoke(touch);
 }
Пример #14
0
 public virtual void OnPointerDown(PointerEventData eventData)
 {
     OnTouchDown?.Invoke();
 }
Пример #15
0
 private void OnDown()
 {
     OnTouchDown?.Invoke(this);
 }
Пример #16
0
 public void HitTheGround(Entity entity)
 {
     Self = new Player(entity);
     Client.PlayerData.Pos = entity.Status.Position;
     OnTouchDown?.Invoke();
 }