示例#1
0
 void tapDetected(TKTapRecognizer r)
 {
     if (!Game.paused)
     {
         PubSub.publish("Click", r.touchLocation());
     }
     else
     {
         PubSub.publish("ClickTV", r.touchLocation());
     }
 }
示例#2
0
        public void OnTapRecognized(TKTapRecognizer r)
        {
            Debug.Log("tap recognized");

            if (!_useNetwork)
            {
                var worldPos = Camera.main.ScreenToWorldPoint(r.touchLocation());
                StartCoroutine(SpawnTapEffect(worldPos, Color.white));
                GameSignals.INPUT_TAP.Dispatch();
            }
            else
            {
                DispatchGenericTap(r.touchLocation());
            }
        }
示例#3
0
        private void OnTap(TKTapRecognizer recognizer)
        {
            if (!_scrollEnabled)
            {
                return;
            }

            var touch = (Vector2)Camera.main.ScreenToViewportPoint(recognizer.touchLocation()) - Vector2.one / 2f;
            // TODO: make configurable
            const float maxTouchDistance = 0.4f;

            if (touch.magnitude > maxTouchDistance)
            {
                return;
            }

            var velocity = (_panVelocity + _magnetVelocity).magnitude;

            // TODO: make configurable
            const float threshold = 0.20f;

            if (velocity > threshold)
            {
                return;
            }

            EnableScroll();
        }
示例#4
0
    public void Erase(TKTapRecognizer r)
    {
        if (lineEditMode != LineEditMode.Erase)
        {
            return;
        }

        LineWorld.main.RemoveLine(r.touchLocation(), eraseRadius);
    }
示例#5
0
        /// <summary>
        /// Called every time the screen is tapped
        /// </summary>
        private void OnTap(TKTapRecognizer recognizer)
        {
            if (!enabled)
            {
                return;
            }

            // Find the nearest node to the tap
            var node = GetNearestNode(recognizer.touchLocation());

            // If the swipe is invalid, don't do anything
            if (node == null)
            {
                return;
            }

            // Otherwise, play the move
            _boardAction.Play(node);
        }