Пример #1
0
        private void ChangePointerPosition()
        {
            INodeData node = nodeGrid.GetNodeFromMousePosition();

            if (node != null)
            {
                Vector2 pos = node.Data.pos;
                tilePointer.transform.position = pos;
                tilePointer.SetActive(true);

                tilePointerBobbing.StartBob();
            }
        }
Пример #2
0
        private void Update()
        {
            MoveToolToMouse();

            if (Input.GetMouseButtonDown(0))
            {
                INodeData node = nodeGrid.GetNodeFromMousePosition();
                if (node != null)
                {
                    nodeToToolOn = node;
                }
                ToolToUse = EquippedTool.ToolType;
            }
        }
Пример #3
0
        public void RequestPath()
        {
            Node start = nodeGrid.GetNodeFromVector2(transform.position);
            Node end   = nodeGrid.GetNodeFromMousePosition();

            // store end node to pass onfailure and onArrival
            endNodeData = end;

            if (start == null || end == null)
            {
                return;
            }

            currentRequest = new PathRequest(Guid.NewGuid().ToString(), start, end, PathFindCallBack);

            requestManager.RequestPath(currentRequest);
            ProcessingPath = true;
        }
Пример #4
0
        /// <summary>
        ///     Moves some IPlaceable to its closest node.
        /// </summary>
        private void MovePlaceableToNode()
        {
            INodeData node = nodeGrid.GetNodeFromMousePosition();


            if (node != null && (Vector2)AttachedPlaceable.transform.position != node.Data.pos)
            {
                if (!AttachedPlaceable.CanBePlaced(node))
                {
                    return;
                }

                currentNode = node;

                AttachedPlaceable.DestinationNodeData = currentNode;
                AttachedPlaceable.ChangePosition(currentNode.Data.pos);
            }
        }