Пример #1
0
 void Update()
 {
     if (Input.GetMouseButtonDown(0) && ikCatchController.HasCaughtBall())
     {
         ikThrowController.StartAim();
     }
     else if (Input.GetMouseButtonUp(0) && ikThrowController.IsAiming())
     {
         // Throw a ball if the bot has one
         ikThrowController.ReadyThrow();
         animator.SetTrigger("Throw");
     }
     if (Input.GetMouseButtonDown(1))
     {
         // Supply the bot with a new ball
         Vector3 ballPos = transform.position + transform.forward * 0.5f;
         ballPos.y += 1.5f;
         GameObject throwable = Instantiate(ballPrefab, ballPos, Quaternion.identity);
     }
 }
Пример #2
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0) &&
            ikThrowController.GetThrowState() == IKThrowController.ThrowState.None &&
            ikCatchController.HasCaughtBall())
        {
            ikThrowController.StartAim();
            ikThrowController.SetThrowPathState(IKThrowController.ThrowPathState.Straight);
            playerCameraController.UseAimCamera();
        }
        else if (Input.GetMouseButtonUp(0) && ikThrowController.IsAiming())
        {
            // Throw a ball if the bot has one
            ikThrowController.ReadyThrow();
            playerCameraController.StopUsingAimCamera();
            animator.SetTrigger("Throw");
        }

        if (ikThrowController.IsAiming())
        {
            if (Input.GetKeyDown(KeyCode.A))
            {
                ikThrowController.MoveTargetLeft();
            }
            if (Input.GetKeyDown(KeyCode.D))
            {
                ikThrowController.MoveTargetRight();
            }
            if (Input.GetKeyDown(KeyCode.W))
            {
                //target = GetNextTarget();
            }
            if (Input.GetKeyDown(KeyCode.S))
            {
                //target = GetNextTarget(false);
            }
            if (Input.GetKeyDown(KeyCode.Q))
            {
                ikThrowController.SetThrowPathState(IKThrowController.ThrowPathState.Straight);
            }
            if (Input.GetKeyDown(KeyCode.E))
            {
                ikThrowController.SetThrowPathState(IKThrowController.ThrowPathState.CurveFromLeft);
            }
            if (Input.GetKeyDown(KeyCode.R))
            {
                ikThrowController.SetThrowPathState(IKThrowController.ThrowPathState.CurveFromAbove);
            }
            if (Input.GetKeyDown(KeyCode.F))
            {
                ikThrowController.SetThrowPathState(IKThrowController.ThrowPathState.CurveFromRight);
            }
        }

        if (Input.GetMouseButtonDown(1))
        {
            // Supply the bot with a new ball
            Vector3 ballPos = transform.position + transform.forward * 0.5f;
            ballPos.y += 1.5f;
            GameObject throwable = Instantiate(ballPrefab, ballPos, Quaternion.identity);
        }
    }