Beispiel #1
0
    private void Update()
    {
        if (Input.GetMouseButtonDown(1) && _unitSelection.HasUnitSelected())
        {
            Ray        ray = _camera.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            Unit[] selectedUnits = _unitSelection.GetSelectedUnits();
            if (Physics.Raycast(ray, out hit, 100, layerMask))
            {
                if (hit.collider.CompareTag("Ground"))
                {
                    UnitsMoveToPosition(hit.point, selectedUnits);
                    CreateSelectionMarker(hit.point);
                }
            }
        }
    }