// Use this for initialization void Start() { refTransform = new GameObject().transform; refTransform.parent = part.transform; refTransform.rotation = Quaternion.LookRotation(vessel.ReferenceTransform.up, -vessel.ReferenceTransform.forward); shipHeading = new Firespitter.ShipHeading(refTransform); needle = base.internalProp.FindModelTransform(needleName); }
// Use this for initialization void Start() { buttonObjectNames = new string[4] { button1, button2, button3, button4 }; //actionGroupList = new ActionGroupList(vessel); for (int i = 0; i < numButtons; i++) { GameObject buttonObject = base.internalProp.FindModelTransform(buttonObjectNames[i]).gameObject; FSgenericButtonHandlerID buttonHandler = buttonObject.AddComponent <FSgenericButtonHandlerID>(); buttonHandler.ID = i; buttonHandler.mouseDownFunction = buttonClick; } targetScript = base.internalProp.FindModelComponent <FSmonitorScript>(); targetScript.textMode = FSmonitorScript.TextMode.singleString; textArray = new string[linesPerPage]; for (int i = 0; i < textArray.Length; i++) { textArray[i] = ""; } buttonArray = new bool[numButtons]; for (int i = 0; i < buttonArray.Length; i++) { buttonArray[i] = false; } // action group numbers gearGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.Gear); brakeGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.Brakes); SASGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.SAS); lightGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.Light); useInfoPopup = getInfoPopupObject(); menuState = menuSplashScreen; refTransform = new GameObject().transform; refTransform.parent = part.transform; refTransform.rotation = Quaternion.LookRotation(vessel.ReferenceTransform.up, -vessel.ReferenceTransform.forward); shipHeadingTool = new Firespitter.ShipHeading(refTransform); }
void Start() { refTransform = new GameObject().transform; refTransform.parent = part.transform; refTransform.rotation = Quaternion.LookRotation(vessel.ReferenceTransform.up, -vessel.ReferenceTransform.forward); shipHeading = new Firespitter.ShipHeading(refTransform); try // overdoing the error protection a bit just because I can't be sure the renderer will be valid { Transform innerDiscTransform = base.internalProp.FindModelTransform(innerDiscName); if (innerDiscTransform != null) { innerDisc = innerDiscTransform.gameObject; discMat = innerDisc.renderer.material; } } catch { Debug.Log("FSartificialHorizon: Can't find object, or its material: " + innerDiscName); } if (discMat == null) { useOffset = false; Debug.Log("FSartificialHorizon: Couldn't find disc material"); } if (useOffset) { testButton = base.internalProp.FindModelTransform(testButtonName).gameObject; minusButton = base.internalProp.FindModelTransform(minusButtonName).gameObject; plusButton = base.internalProp.FindModelTransform(plusButtonName).gameObject; testButtonHandler = testButton.AddComponent <FSgenericButtonHandler>(); minusButtonHandler = minusButton.AddComponent <FSgenericButtonHandler>(); plusButtonHandler = plusButton.AddComponent <FSgenericButtonHandler>(); testButtonHandler.mouseDownFunction = testCageToggle; minusButtonHandler.mouseDownFunction = cageMinus; plusButtonHandler.mouseDownFunction = cagePlus; } needle = base.internalProp.FindModelTransform(outerRingName); }
void Start() { refTransform = new GameObject().transform; refTransform.parent = part.transform; refTransform.rotation = Quaternion.LookRotation(vessel.ReferenceTransform.up, -vessel.ReferenceTransform.forward); shipHeading = new Firespitter.ShipHeading(refTransform); try // overdoing the error protection a bit just because I can't be sure the renderer will be valid { Transform innerDiscTransform = base.internalProp.FindModelTransform(innerDiscName); if (innerDiscTransform != null) { innerDisc = innerDiscTransform.gameObject; discMat = innerDisc.renderer.material; } } catch { Debug.Log("FSartificialHorizon: Can't find object, or its material: " + innerDiscName); } if (discMat == null) { useOffset = false; Debug.Log("FSartificialHorizon: Couldn't find disc material"); } if (useOffset) { testButton = base.internalProp.FindModelTransform(testButtonName).gameObject; minusButton = base.internalProp.FindModelTransform(minusButtonName).gameObject; plusButton = base.internalProp.FindModelTransform(plusButtonName).gameObject; testButtonHandler = testButton.AddComponent<FSgenericButtonHandler>(); minusButtonHandler = minusButton.AddComponent<FSgenericButtonHandler>(); plusButtonHandler = plusButton.AddComponent<FSgenericButtonHandler>(); testButtonHandler.mouseDownFunction = testCageToggle; minusButtonHandler.mouseDownFunction = cageMinus; plusButtonHandler.mouseDownFunction = cagePlus; } needle = base.internalProp.FindModelTransform(outerRingName); }
//public float getRoll() //{ // rollLevel.rotation = Quaternion.LookRotation(refDirection.forward, worldUp); // float result = rollLevel.localRotation.eulerAngles.z; // if (result > 180f) result -= 360f; // return result; //} //public float getPitch() //{ // //pitchLevel.position = refDirection.position; // pitchLevel.rotation = Quaternion.LookRotation(refDirection.right, worldUp); // float result = pitchLevel.localRotation.eulerAngles.z; // if (result > 180f) result -= 360f; // return result; //} // Use this for initialization void Start() { //rollLevel = new GameObject().transform; //rollLevel.transform.parent = refDirection; //rollLevel.localPosition = Vector3.zero; //pitchLevel = new GameObject().transform; //pitchLevel.transform.parent = refDirection; //pitchLevel.localPosition = Vector3.zero; refTransform = new GameObject().transform; refTransform.parent = part.transform; refTransform.rotation = Quaternion.LookRotation(vessel.ReferenceTransform.up, -vessel.ReferenceTransform.forward); shipHeading = new Firespitter.ShipHeading(refTransform); if (useOffset) { testButton = base.internalProp.FindModelTransform(testButtonName).gameObject; minusButton = base.internalProp.FindModelTransform(minusButtonName).gameObject; plusButton = base.internalProp.FindModelTransform(plusButtonName).gameObject; testButtonHandler = testButton.AddComponent <FSgenericButtonHandler>(); minusButtonHandler = minusButton.AddComponent <FSgenericButtonHandler>(); plusButtonHandler = plusButton.AddComponent <FSgenericButtonHandler>(); testButtonHandler.mouseDownFunction = testCageToggle; minusButtonHandler.mouseDownFunction = cageMinus; plusButtonHandler.mouseDownFunction = cagePlus; discMat = innerDisc.renderer.material; } needle = base.internalProp.FindModelTransform(outerRingName); innerDisc = base.internalProp.FindModelTransform(innerDiscName).gameObject; if (discMat == null) { useOffset = false; //Debug.Log("FSartificialHorizon: Couldn't find disc material"); } }
//public float getRoll() //{ // rollLevel.rotation = Quaternion.LookRotation(refDirection.forward, worldUp); // float result = rollLevel.localRotation.eulerAngles.z; // if (result > 180f) result -= 360f; // return result; //} //public float getPitch() //{ // //pitchLevel.position = refDirection.position; // pitchLevel.rotation = Quaternion.LookRotation(refDirection.right, worldUp); // float result = pitchLevel.localRotation.eulerAngles.z; // if (result > 180f) result -= 360f; // return result; //} // Use this for initialization void Start() { //rollLevel = new GameObject().transform; //rollLevel.transform.parent = refDirection; //rollLevel.localPosition = Vector3.zero; //pitchLevel = new GameObject().transform; //pitchLevel.transform.parent = refDirection; //pitchLevel.localPosition = Vector3.zero; refTransform = new GameObject().transform; refTransform.parent = part.transform; refTransform.rotation = Quaternion.LookRotation(vessel.ReferenceTransform.up, -vessel.ReferenceTransform.forward); shipHeading = new Firespitter.ShipHeading(refTransform); if (useOffset) { testButton = base.internalProp.FindModelTransform(testButtonName).gameObject; minusButton = base.internalProp.FindModelTransform(minusButtonName).gameObject; plusButton = base.internalProp.FindModelTransform(plusButtonName).gameObject; testButtonHandler = testButton.AddComponent<FSgenericButtonHandler>(); minusButtonHandler = minusButton.AddComponent<FSgenericButtonHandler>(); plusButtonHandler = plusButton.AddComponent<FSgenericButtonHandler>(); testButtonHandler.mouseDownFunction = testCageToggle; minusButtonHandler.mouseDownFunction = cageMinus; plusButtonHandler.mouseDownFunction = cagePlus; discMat = innerDisc.renderer.material; } needle = base.internalProp.FindModelTransform(outerRingName); innerDisc = base.internalProp.FindModelTransform(innerDiscName).gameObject; if (discMat == null) { useOffset = false; //Debug.Log("FSartificialHorizon: Couldn't find disc material"); } }
// Use this for initialization void Start() { buttonObjectNames = new string[4] {button1,button2,button3,button4}; //actionGroupList = new ActionGroupList(vessel); for (int i = 0; i < numButtons; i++) { GameObject buttonObject = base.internalProp.FindModelTransform(buttonObjectNames[i]).gameObject; FSgenericButtonHandlerID buttonHandler = buttonObject.AddComponent<FSgenericButtonHandlerID>(); buttonHandler.ID = i; buttonHandler.mouseDownFunction = buttonClick; } targetScript = base.internalProp.FindModelComponent<FSmonitorScript>(); targetScript.textMode = FSmonitorScript.TextMode.singleString; textArray = new string[linesPerPage]; for (int i = 0; i < textArray.Length; i++) { textArray[i] = ""; } buttonArray = new bool[numButtons]; for (int i = 0; i < buttonArray.Length; i++) { buttonArray[i] = false; } // action group numbers gearGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.Gear); brakeGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.Brakes); SASGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.SAS); lightGroupNumber = BaseAction.GetGroupIndex(KSPActionGroup.Light); useInfoPopup = getInfoPopupObject(); menuState = menuSplashScreen; refTransform = new GameObject().transform; refTransform.parent = part.transform; refTransform.rotation = Quaternion.LookRotation(vessel.ReferenceTransform.up, -vessel.ReferenceTransform.forward); shipHeadingTool = new Firespitter.ShipHeading(refTransform); }