Esempio n. 1
0
    public override void Apply(TouchEvent touchEvent)
    {
        if (!swipeStarted && CheckForSwipeStart(touchEvent))
        {
            StartSwipe(touchEvent);
        }
        //Note this is not an else-if because a swipe can potentially start and end on the same frame
        if (swipeStarted && touchEvent.GetCurrentState() == TouchPhase.Ended)
        {
            if (CheckForSwipeEnd(touchEvent))
            {
                hero.ClearAnimationState();
                StartCoroutine(DrawSwipeAttack(touchEvent));
            }
            else
            {
                cancelSwipe();
            }
        }

        if (swipeStarted && touchEvent.GetCurrentState() == TouchPhase.Canceled)
        {
            cancelSwipe();
        }
    }