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(); }
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; }
private void ClearSelectedAgents() { foreach (Agent agent in SelectedAgents) { if (agent != null) { agent.Selected = false; } } SelectedAgents.Clear(); Helpers.DeleteAllChildren(selectedIndicatorParent); }