Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.C))
        {
            //send out a ray
            ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width * 0.5f, Screen.height * 0.5f, 0));

            if (!coverEngaged)
            {
                //check for a hit
                if (Physics.Raycast(ray, out hit))
                {
                    radius = Vector3.Distance(transform.position, hit.transform.position);

                    if (radius <= minGrappleDistance)
                    {
                        coverEngaged = true;
                        targetCenter = hit.transform.position;
                        effectsController.StartGrapple(targetCenter);
                    }
                }
            }
            else
            {
                coverEngaged = false;
                effectsController.EndGrapple();
            }
        }
    }