Пример #1
0
    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();
        }
    }
Пример #2
0
        private void OnNodeDeselected(NodeDeselected msg)
        {
            if (msg.NodeId != _entityId)
            {
                return;
            }

            ClearTop();
        }
Пример #3
0
    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();
        }