Esempio n. 1
0
    /// <summary>
    /// Check Touch
    /// </summary>
    /// <param name="eventData"></param>
    public void OnPointerDown(PointerEventData eventData)
    {
        ClickVFX.SetVFXStatus(true);
        currentState = AllState.State.Touch;

        StartCoroutine(ReturnCurrentState());
    }
Esempio n. 2
0
 /// <summary>
 /// Check Swipe
 /// </summary>
 /// <param name="eventData"></param>
 public void OnBeginDrag(PointerEventData eventData)
 {
     /// swipe was on Horizontal
     if (Mathf.Abs(eventData.delta.x) > Mathf.Abs(eventData.delta.y))
     {
         ///swipe was on Right
         if (eventData.delta.x > 0)
         {
             currentState = AllState.State.Right;
         }
         /// swipe was on Left
         else
         {
             currentState = AllState.State.Left;
         }
     }
     /// swipe was on Vertical
     else
     {
         ///swipe was on Top
         if (eventData.delta.y > 0)
         {
             currentState = AllState.State.Top;
         }
         /// swipe was on Down
         else
         {
             currentState = AllState.State.Down;
         }
     }
 }
Esempio n. 3
0
    /// <summary>
    /// Main core of card manager
    /// Get card state and check that playrs move  was correct
    /// </summary>
    /// <param name="newState"></param>
    /// <param name="gameManager"></param>
    public void CheckCorrectState(AllState.State newState, GameLoopManager gameManager)
    {
        bool stateOfCheck = false;

        if (newState == stateNeed[currentStateNeed])
        {
            if (isNot) // wrong
            {
                stateOfCheck = false;
                SendResult(stateOfCheck, gameManager);
            }
            else // correct!
            {
                stateOfCheck = true;
                currentStateNeed++;
                if (currentStateNeed >= stateLength)
                {
                    SendResult(stateOfCheck, gameManager);
                }
            }
        }
        else
        {
            if (isNot && newState != AllState.State.Touch) // correct
            {
                stateOfCheck = true;
                currentStateNeed++;
                if (currentStateNeed >= stateLength)
                {
                    SendResult(stateOfCheck, gameManager);
                }
            }
            else // wrong
            {
                stateOfCheck = false;
                SendResult(stateOfCheck, gameManager);
            }
        }

        MoveCard();
    }