Beispiel #1
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);
     }
 }
Beispiel #2
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);
        }
    }