示例#1
0
    private void Fish()
    {
        if (Input.GetMouseButtonDown(0) && !fishingRod.GetIsBobberCast())
        {
            CinemachineBrain brain  = FindObjectOfType <CinemachineBrain>();
            Camera           camera = brain.OutputCamera;
            Ray        ray          = camera.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                if (hit.collider.gameObject.CompareTag("water") || hit.collider.gameObject.layer == 11)
                {
                    //print("Hit point: " + hit.point);
                    fishingRod.castRod(hit.point);
                    //print("rod casted");
                }
            }
        }

        //TODO: implement ending minigame when reelIn();
        else if (Input.GetMouseButtonDown(0) && fishingRod.GetIsBobberCast())
        {
            if (!fishingRod.isFish())
            {
                fishingRod.reelIn();
            }
        }
    }