Example #1
0
    void HandleTouchInput()
    {
        anim.SetBool("isShooting", false);
        switch (swipeControl.GetSwipeDirection())
        {
        case SwipeDetector.SwipeDirection.Right:
            controller.Rotate(new Vector3(0f, 90f, 0f));
            break;

        case SwipeDetector.SwipeDirection.Left:
            controller.Rotate(new Vector3(0f, -90f, 0f));
            break;

        case SwipeDetector.SwipeDirection.Jump:
            controller.Rotate(new Vector3(0f, 90f, 0f));
            break;

        case SwipeDetector.SwipeDirection.Duck:
            controller.Rotate(new Vector3(0f, -90f, 0f));
            break;

        case SwipeDetector.SwipeDirection.ChangeWeapon:
            anim.SetInteger("weaponNum", weaponManager.SwitchToNextWeapon());
            break;

        case SwipeDetector.SwipeDirection.Attack:
            anim.SetBool("isShooting", true);
            weaponManager.Use();
            break;
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            anim.SetBool("isShooting", true);
            weaponManager.Use();
        }

        if (Input.GetKeyDown(KeyCode.Z))
        {
            controller.Rotate(new Vector3(0f, -90f, 0f));
        }
        if (Input.GetKeyDown(KeyCode.X))
        {
            controller.Rotate(new Vector3(0f, 90f, 0f));
        }
        if (Input.GetKeyDown(KeyCode.C))
        {
            anim.SetInteger("weaponNum", weaponManager.SwitchToNextWeapon());
        }
    }
Example #2
0
    void HandleTouchInput()
    {
        switch (swipeControl.GetSwipeDirection())
        {
        case SwipeDetector.SwipeDirection.Right:
            controller.Rotate(new Vector3(0f, 90f, 0f));
            break;

        case SwipeDetector.SwipeDirection.Left:
            controller.Rotate(new Vector3(0f, -90f, 0f));
            break;

        case SwipeDetector.SwipeDirection.Shoot:
            gunController.Shoot();
            break;
        }
    }