示例#1
0
    void Update()
    {
        transform.position = Vector3.MoveTowards(transform.position, transform.position + Vector3.forward, playerSpeed);

        if (inputX.IsInput())
        {
            isGameStarted = true;

            GeneralInput gInput = inputX.GetInput(0);

            if (gInput.phase == IPhase.Began || gInput.phase == IPhase.Stationary || gInput.phase == IPhase.Ended || gInput.phase == IPhase.Canceled)
            {
                touchStartPos = gInput.currentPosition;
            }
            else
            {
                Vector2 touchAlpha = gInput.currentPosition - touchStartPos;
                if (touchAlpha.x > 1f && !moveHandsToRight)
                {
                    moveHandsToRight = true;
                    moveHandsToLeft  = false;
                }
                else if (touchAlpha.x < -1f && !moveHandsToLeft)
                {
                    moveHandsToLeft  = true;
                    moveHandsToRight = false;
                }
            }
        }
    }
示例#2
0
    void Update()
    {
        if(inputX.IsInput())
        {
            GeneralInput gInput = inputX.GetInput(0);
          
            if(gInput.phase == IPhase.Began)
            {
                isTouchEnded = false;
                StartCoroutine(Fire());
                touchStartPos = gInput.currentPosition;
            }
            else if(gInput.phase == IPhase.Ended)
            {
                isTouchEnded = true;

                if(routeFollower!=null)
                    StopCoroutine(routeFollower); //Corountine inputla beraber bitmediginden burada durduruluyor. yukarda alinan input corountine sokuluyor ama sonradan editlenmiyor. 

                coroutineAllowed = true;
                touchDeltaX = 0;
            }
            else
            {