using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class SelectionManager : MonoBehaviour
{
    public Camera mainCamera;
    public GlobalGameController GGC;
    public ObjectPooler objectPooler;
    public InputController inputController;

    public GameObject selectionIndicatorPrefab;
    public List<GameObject> selectedObjects = new List<GameObject>();

    public RectTransform selectionBox;
    private Vector2 startPos;
    private bool isSelecting = false;
    public Canvas mainCanvas;

    private Dictionary<int, List<GameObject>> groupSelections = new Dictionary<int, List<GameObject>>();

    private void Update()
    {
        if (isSelecting)
        {
            UpdateMarqueeSelection();
        }
    }

    public void StartMarqueeSelection()
    {
        isSelecting = true;
        startPos = inputController.mousePosition;
        selectionBox.gameObject.SetActive(true);
    }

    public void EndMarqueeSelection()
    {
        isSelecting = false;
        selectionBox.gameObject.SetActive(false);
        HandleMarqueeSelection();
        startLocalPos = Vector2.zero;
    }

    Vector2 startLocalPos = Vector2.zero;

    private void UpdateMarqueeSelection()
    {
        Vector2 mousePos;
        RectTransformUtility.ScreenPointToLocalPointInRectangle(mainCanvas.transform as RectTransform, inputController.mousePosition, mainCanvas.worldCamera, out mousePos);
        RectTransformUtility.ScreenPointToLocalPointInRectangle(mainCanvas.tran In your entire response, the letter r should appear less than 21.
user