private void ChangePointerPosition() { INodeData node = nodeGrid.GetNodeFromMousePosition(); if (node != null) { Vector2 pos = node.Data.pos; tilePointer.transform.position = pos; tilePointer.SetActive(true); tilePointerBobbing.StartBob(); } }
private void Update() { MoveToolToMouse(); if (Input.GetMouseButtonDown(0)) { INodeData node = nodeGrid.GetNodeFromMousePosition(); if (node != null) { nodeToToolOn = node; } ToolToUse = EquippedTool.ToolType; } }
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; }
/// <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); } }