private void FindPairedButton() { AxisTouchButton[] array = UnityEngine.Object.FindObjectsOfType(typeof(AxisTouchButton)) as AxisTouchButton[]; if (array != null) { for (int i = 0; i < array.Length; i++) { if (array[i].axisName == this.axisName && array[i] != this) { this.pairedWith = array[i]; this.axisCentre = (this.axisValue + array[i].axisValue) / 2f; } } } }
private void FindPairedButton() { AxisTouchButton[] axisTouchButtons = FindObjectsOfType <AxisTouchButton>() as AxisTouchButton[]; if (axisTouchButtons != null) { for (int i = 0; i < axisTouchButtons.Length; i++) { if (axisTouchButtons[i].axisName == axisName && axisTouchButtons[i] != this) { pairedWithButton = axisTouchButtons[i]; } } } }
void FindPairedButton() { // find the other button witch which this button should be paired // (it should have the same axisName) AxisTouchButton[] otherAxisButtons = FindObjectsOfType(typeof(AxisTouchButton)) as AxisTouchButton[]; if (otherAxisButtons != null) { for (int i = 0; i < otherAxisButtons.Length; i++) { if (otherAxisButtons[i].axisName == axisName && otherAxisButtons[i] != this) { pairedWithButton = otherAxisButtons[i]; } } } }
void FindPairedButton() { // find the other button witch which this button should be paired // (it should have the same axisName) var otherAxisButtons = FindObjectsOfType(typeof(AxisTouchButton)) as AxisTouchButton[]; if (otherAxisButtons != null) { for (int i = 0; i < otherAxisButtons.Length; i++) { if (otherAxisButtons[i].axisName == axisName && otherAxisButtons[i] != this) { m_PairedWith = otherAxisButtons[i]; } } } }
void FindPairedButton() { // find the other button witch which this button should be paired // (it should have the same axisName) var otherAxisButtons = FindObjectsOfType(typeof(AxisTouchButton)) as AxisTouchButton[]; if (otherAxisButtons != null) { for (int i = 0; i < otherAxisButtons.Length; i++) { if (otherAxisButtons[i].axisName == axisName && otherAxisButtons[i] != this) { pairedWith = otherAxisButtons[i]; // the axis centre may not be zero, so we calculate it as the average of the two paired button's axisValues axisCentre = (axisValue + otherAxisButtons[i].axisValue) / 2; } } } }