private void Launch() { _launched = false; // Use object already set in UpdateRaycast if (RaycastSelectObject != null) { NodeBehaviour newNode = RaycastSelectObject.GetComponent <NodeBehaviour>(); if (newNode != null) { if (newNode.IsCursorSelected && newNode.IsOpen) { // Update this NodeBehaviour NodeBehaviour currentNode = GetComponentInParent <NodeBehaviour>(); currentNode.OnTravelFrom(); SetToNode(RaycastSelectObject); newNode.OnTravelTo(); _launched = true; GameLoop.Instance.CurrentLevel.PushLightLine(currentNode.transform, newNode.transform); } else { newNode.FlashWarningColor(); } } } }
private void Launch() { _launched = true; var launchDirection = LaunchDirector.transform.position - transform.position; var ray = new Ray(transform.position, launchDirection); bool resetLaunch = true; RaycastHit hit; if (Physics.Raycast(ray, out hit, LaunchDistance)) { NodeBehaviour nodeObj = hit.transform.GetComponent <NodeBehaviour>(); if (nodeObj != null) { if (nodeObj.IsSelected) { if (nodeObj.IsOpen) { EnergizeNode(hit.transform.gameObject); CurrentSymbolData.ProcessUpdate(nodeObj._keyData); nodeObj.OnTravelTo(); resetLaunch = false; } } else { nodeObj.FlashWarningColor(); } } } if (resetLaunch) { _launched = false; } }