void Update() { generateBezierSpline(); if (destinObject && originObject && isEndingPointSnapped) { // GetComponent<LineRenderer>().SetPosition(0, // new Vector3 (originObject.transform.position.x + (originObject.GetComponent<SpriteRenderer> ().bounds.size.x) / 2, // originObject.transform.position.y, // originObject.transform.position.z)); // GetComponent<LineRenderer>().SetPosition(0, originObject.transform.position); // GetComponent<LineRenderer>().SetPosition(1, destinObject.transform.position); } forwardInput(input, output); if (originObject) { if (originObject.CompareTag("inputDot")) { tempBreadBoardInput = originObject.GetComponent <BreadBoardInputPin>(); if (tempBreadBoardInput.inputType != "") { GetComponent <LineRenderer>().startColor = originObject.GetComponent <SpriteRenderer>().color; GetComponent <LineRenderer>().endColor = originObject.GetComponent <SpriteRenderer>().color; } } else if (originObject.CompareTag("output")) { GetComponent <LineRenderer>().startColor = originObject.GetComponent <SpriteRenderer>().color; GetComponent <LineRenderer>().endColor = originObject.GetComponent <SpriteRenderer>().color; } } }
public void TaskOnClick() { bbInputPinScript = Manager.currentInputPin.GetComponent <BreadBoardInputPin>(); if (status == "analog") // if new status is analog { bbInputPinScript.startSine(); } else if (status == "digital") // if new status is digital { bbInputPinScript.CancelInvoke(); if (bbInputPinScript.inputType == "analog") { bbInputPinScript.inputValue = 0; } } bbInputPinScript.inputType = status; transform.parent.parent.GetComponent <Canvas>().enabled = false; sr.enabled = false; Manager.currentInputPin = null; }
// forwardInput() in Line.cs takes input value and copies value to target object public void forwardInput(float input, float output) { string typeOfOriginObject, typeOfDestinObject; // Checking the type of origin if (originObject != null) { typeOfOriginObject = originObject.gameObject.name; if (originObject.CompareTag("inputDot")) { breadboardInputPinScript = originObject.GetComponent <BreadBoardInputPin> (); this.output = breadboardInputPinScript.inputValue; this.input = breadboardInputPinScript.inputValue; } else if (typeOfOriginObject.Contains("Output")) { functionBlockScript = originObject.GetComponentInParent <FunctionBlock> (); this.output = functionBlockScript.output; } else if (originObject.CompareTag("inputDotAnalog")) { this.output = originObject.GetComponent <AnalogInputDot> ().value; } } // Checking the type of destination if (destinObject != null) { typeOfDestinObject = destinObject.gameObject.name; if (typeOfDestinObject.Contains("Input")) { functionBlockScript = destinObject.GetComponentInParent <FunctionBlock> (); if (typeOfDestinObject.Contains("Input 1")) { if (destinObject.transform.parent.gameObject.transform.parent.name.Contains("_VALUE") || destinObject.transform.parent.gameObject.transform.parent.name.Contains("_IF")) { functionBlockScript.inputs[0] = this.output; } else { functionBlockScript.inputs [0] = (int)this.output; } } else if (typeOfDestinObject.Contains("Input 2")) { functionBlockScript.inputs [1] = (int)this.output; } else if (destinObject.transform.parent.name.Contains("VALUE")) { functionBlockScript.inputs [0] = this.output; } } else if (typeOfDestinObject.Contains("output_dot")) { breadboardOutputPinScript = destinObject.GetComponent <BreadBoardOutputPin> (); breadboardOutputPinScript.input = this.output; } } }