示例#1
0
    public void Update()
    {
        // Some will have been removed
        SelectedAgents.RemoveAll(s => s == null);

        if (Input.GetKeyDown(KeyCode.H))
        {
            HypnotizeSelected();
        }

        Instance = this;
        if (EventSystem.current.IsPointerOverGameObject())
        {
            return;
        }

        if (Input.GetMouseButtonDown(0))
        {
            isSelecting    = true;
            selectionStart = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        }

        if (isSelecting)
        {
            selectionEnd = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        }

        if (Input.GetMouseButtonUp(0) && isSelecting)
        {
            isSelecting = false;
            AreaSelected();
        }

        DrawSelection();
    }
示例#2
0
    public void SelectAgent(Agent agent)
    {
        SelectedAgents.Add(agent);
        UiFollow2D uiFollow2D = (UiFollow2D)Instantiate(selectedIndicatorPrefab, Vector2.zero, Quaternion.identity);

        uiFollow2D.sizeExpansion = selectedIndicatorExpansion;
        uiFollow2D.transform.SetParent(selectedIndicatorParent, true);
        uiFollow2D.follow = agent.transform;
        agent.Selected    = true;
    }
示例#3
0
 private void ClearSelectedAgents()
 {
     foreach (Agent agent in SelectedAgents)
     {
         if (agent != null)
         {
             agent.Selected = false;
         }
     }
     SelectedAgents.Clear();
     Helpers.DeleteAllChildren(selectedIndicatorParent);
 }