Beispiel #1
0
    private void DoInteraction()
    {
        Ray        ray = cam.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, interactDist))
        {
            if (hit.collider.tag == "Harvest")
            {
                if (Input.GetMouseButtonDown(0))
                {
                    Harvest currentHarvest = hit.collider.GetComponent <Harvest>();
                    currentHarvest.HarvestResources(10f);
                }
            }
        }
    }