void Update() { if (CheckIfEnemyHover()) { NodeDeselected?.Invoke(); Debug.Log("Hovering enemy"); } else if (CheckIfTowerHover()) { NodeDeselected?.Invoke(); Debug.Log("Hovering Tower"); } else { CheckIfNodeMouseHover(); Debug.Log("Hovering Node"); } if (mouse.rightButton.wasPressedThisFrame) { if (!PlayerAttack()) { MoveToPoint(); } } if (mouse.leftButton.wasPressedThisFrame) { BuildTurret(); } }
private void OnNodeDeselected(NodeDeselected msg) { if (msg.NodeId != _entityId) { return; } ClearTop(); }
void CheckIfNodeMouseHover() { NodeDeselected?.Invoke(); RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(mouse.position.ReadValue()); if (Physics.Raycast(ray, out hit, Mathf.Infinity, nodeLayer)) { NodeSelected?.Invoke(hit.transform.position); } }
private void OnNodeDeselected(NodeDeselected msg) { var item = _items[msg.NodeId]; item.ShowAsNotSelected(); }