// Update is called once per frameysour void Update() { if (EventSystem.current.IsPointerOverGameObject()) { return; } if (Input.GetMouseButtonDown(0)) { Ray camRay = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit raycastHit; if (Physics.Raycast(camRay, out raycastHit, 1000.0f, _selectableLayer)) { GameObject gameObject = raycastHit.collider.transform.parent.gameObject; if (gameObject.CompareTag("Ant")) { _agentStatusPanel.GetComponent <AntStatusDisplay> ().SetAgent(gameObject); _sidebar.ShowPanel(_agentStatusPanel); } else if (gameObject.CompareTag("Resource")) { _resourceStatusPanel.GetComponent <ResourceStatusDisplay> ().SetResource(gameObject); _sidebar.ShowPanel(_resourceStatusPanel); } else if (gameObject.CompareTag("Enemy")) { _enemyStatusPanel.GetComponent <EnemyStatusDisplay> ().SetEnemy(gameObject); _sidebar.ShowPanel(_enemyStatusPanel); } } } }
// Requests the sidebar to open the panel. public void OnClick() { _sidebar.ShowPanel(_panel); }