Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (!GetActionsLocked())
        {
            if (Input.GetMouseButton(0))
            {
                Ray        ray = cam.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;

                if (Physics.Raycast(ray, out hit, 100, movementMask))
                {
                    Interactable interactable = hit.collider.GetComponent <Interactable>();

                    if (interactable != null)
                    {
                        SetFocus(interactable);
                    }
                    else
                    {
                        RemoveFocus();
                        motor.MoveToPoint(hit.point);
                    }
                }
            }
            if (Input.GetMouseButtonDown(1))
            {
                StartCoroutine(spellController.castCurrentSpell());
            }
        }
    }