示例#1
0
        /// <inheritdoc />
        protected override void touchesMoved(IList <TouchPoint> touches)
        {
            base.touchesMoved(touches);

            for (var i = 0; i < touches.Count; i++)
            {
                var touch = touches[i];
                var data  = getPointerData(touch);
                if (TouchUtils.IsTouchOnTarget(touch, cachedTransform))
                {
                    if (!data.OnTarget)
                    {
                        data.OnTarget = true;
                        ExecuteEvents.Execute(gameObject, data.Data, ExecuteEvents.pointerEnterHandler);
                    }
                }
                else
                {
                    if (data.OnTarget)
                    {
                        data.OnTarget = false;
                        ExecuteEvents.Execute(gameObject, data.Data, ExecuteEvents.pointerExitHandler);
                    }
                }
                setPointerData(touch, data);
            }

            Debug.Log("touches moved");
        }
示例#2
0
 public override void Apply(TouchEvent touchEvent)
 {
     if (touchEvent.GetCurrentState() == TouchPhase.Ended && IsTap(touchEvent))
     {
         Vector3 target;
         if (TouchUtils.TouchPositionToWorldCoords(touchEvent.GetStartPosition(), out target, hero.transform.position.y))
         {
             hero.MoveToTarget(target);
         }
     }
 }
示例#3
0
    private void StartSwipe(TouchEvent touchEvent)
    {
        Vector3 lookPosition;

        if (TouchUtils.TouchPositionToWorldCoords(touchEvent.GetEndPosition(), out lookPosition, 0.5f))
        {
            swipeStarted = true;
            hero.CancelMoveToTarget();
            hero.LookAt(lookPosition, attackTime);
            hero.StartSwipeAttack();
        }
    }
示例#4
0
 IEnumerator WaitForInput()
 {
     while (true)
     {
         if (TouchUtils.GetTapCount() == 1 || Input.GetKeyDown(KeyCode.C))
         {
             SceneSettings.Instance.LockInput = true;
             Time.timeScale = 1f;
             tutorialCanvas.SetActive(false);
             break;
         }
         yield return(null);
     }
 }
示例#5
0
    private IEnumerator DrawSwipeAttack(TouchEvent touchEvent, float swipeTime = 0.2f)
    {
        int            vertexCount = 0;
        List <Vector2> swipe       = smoothSwipeInput(simplifySwipeInput(touchEvent));

        foreach (Vector2 frame in swipe)
        {
            Vector3 currentTouchWorld;
            TouchUtils.TouchPositionToWorldCoords(frame, out currentTouchWorld, 0.5f);
            lineAttack.numPositions = vertexCount + 1;
            lineAttack.SetPosition(vertexCount++, currentTouchWorld);
            yield return(new WaitForSeconds(swipeTime / swipe.Count));
        }
        swipeStarted = false;
    }
示例#6
0
 IEnumerator WaitForInput()
 {
     while (true)
     {
         var touchedObj = TouchUtils.GetTouchedObject();
         if (touchedObj != null && touchedObj.tag == "Wizard")
         {
             SceneSettings.Instance.LockInput = true;
             Time.timeScale = 1f;
             tutorialCanvas.SetActive(false);
             break;
         }
         yield return(null);
     }
 }
示例#7
0
    private void GetInput()
    {
        if (SceneSettings.Instance.LockInput)
        {
            return;
        }
        int swipe      = TouchUtils.GetSwipe();
        var touchedObj = TouchUtils.GetTouchedObject();

        if (touchedObj != null &&
            touchedObj.tag == "Wizard" &&
            (CurrentState & (FLAG_STATE_FADE | FLAG_STATE_FADE_SLASH | FLAG_STATE_DIE)) == 0)
        {
            if (!touchedObj.GetComponent <WizardController>().IsDead)
            {
                fadeSlashCommand.SetTarget(touchedObj.transform);
                InputQueue.Enqueue(inputFadeSlash);
                return;
            }
        }

        if ((Input.GetKeyDown(KeyCode.X) || swipe == TouchUtils.SWIPE_UP) && InputQueue.Count <= MAX_INPUT_QUEUE)
        {
            InputQueue.Enqueue(inputJump);
        }

        if ((TouchUtils.GetTapCount() == 1 || Input.GetKeyDown(KeyCode.C)) &&
            InputQueue.Count <= MAX_INPUT_QUEUE &&
            (CurrentState & (FLAG_STATE_FADE | FLAG_STATE_FADE_SLASH)) == 0)
        {
            InputQueue.Enqueue(inputSlash);
        }

        if ((Input.GetKeyDown(KeyCode.DownArrow) || swipe == TouchUtils.SWIPE_DOWN) && InputQueue.Count <= MAX_INPUT_QUEUE)
        {
            InputQueue.Enqueue(inputSlide);
        }

        if ((Input.GetKeyDown(KeyCode.RightArrow) || swipe == TouchUtils.SWIPE_RIGHT) && InputQueue.Count <= MAX_INPUT_QUEUE)
        {
            InputQueue.Enqueue(inputThrow);
        }
    }
示例#8
0
        public void Evaluate(int spreadMax)
        {
            spreadMax = CalculateMax();

            TouchUtils.SetIsNew(FBlobIn, FPBlobs);

            if (IdIn.IsChanged || CheckForReinit())
            {
                NeedsReinit();
            }

            for (var i = 0; i < spreadMax; i++)
            {
                if (ReinitTransforms)
                {
                    Reinit(i);
                }

                if (ResetIn[i])
                {
                    Reset(i);
                }

                TransformStates[i].Update(FBlobIn);

                Debug.WriteLine(TransformStates[i].Phase);

                if (TransformStates[i].Phase == TransformPhase.Transforming)
                {
                    ProcessTransformation(i);
                }

                TransformStates[i].UpdatePValues();
            }

            ReinitTransforms   = false;
            FPBlobs.SliceCount = FBlobIn.SliceCount;

            FPBlobs.AssignFrom(FBlobIn);

            OutputData(spreadMax);
        }
示例#9
0
        /// <inheritdoc />
        protected override void touchMoved(TouchPoint touch)
        {
            base.touchMoved(touch);

            var data = getPointerData(touch);

            if (TouchUtils.IsTouchOnTarget(touch, cachedTransform))
            {
                if (!data.OnTarget)
                {
                    data.OnTarget = true;
                    ExecuteEvents.Execute(gameObject, data.Data, ExecuteEvents.pointerEnterHandler);
                }
            }
            else
            {
                if (data.OnTarget)
                {
                    data.OnTarget = false;
                    ExecuteEvents.Execute(gameObject, data.Data, ExecuteEvents.pointerExitHandler);
                }
            }
            setPointerData(touch, data);
        }