public void Start() { addWheel(flightTimeCounterMin, hour0); addWheel(flightTimeCounterMin, hour1); addWheel(flightTimeCounterHour, hour2); addWheel(flightTimeCounterHour, hour3); addWheel(flightTimeCounterHour, hour4); addWheel(cycleCounter, cycle0); addWheel(cycleCounter, cycle1); addWheel(cycleCounter, cycle2); flightTimeCounterHour.rotationAxis = rotationAxis; flightTimeCounterHour.defaultRotation = defaultRotation; flightTimeCounterMin.rotationAxis = rotationAxis; flightTimeCounterMin.defaultRotation = defaultRotation; cycleCounter.rotationAxis = rotationAxis; cycleCounter.defaultRotation = defaultRotation; //Debug.Log("altimeter Counter list: " + analogCounter.wheels.Count); maintenanceInfo = part.Modules.OfType<FSmaintenanceInfo>().FirstOrDefault(); if (maintenanceInfo != null) { flightTime = maintenanceInfo.flightTime; cycles = maintenanceInfo.cycles; } cycleButton = base.internalProp.FindModelTransform(cycleButtonName).gameObject; cycleButtonHandler = cycleButton.AddComponent<FSgenericButtonHandler>(); cycleButtonHandler.mouseDownFunction = addCycle; }
public void Start() { addWheel(flightTimeCounterMin, hour0); addWheel(flightTimeCounterMin, hour1); addWheel(flightTimeCounterHour, hour2); addWheel(flightTimeCounterHour, hour3); addWheel(flightTimeCounterHour, hour4); addWheel(cycleCounter, cycle0); addWheel(cycleCounter, cycle1); addWheel(cycleCounter, cycle2); flightTimeCounterHour.rotationAxis = rotationAxis; flightTimeCounterHour.defaultRotation = defaultRotation; flightTimeCounterMin.rotationAxis = rotationAxis; flightTimeCounterMin.defaultRotation = defaultRotation; cycleCounter.rotationAxis = rotationAxis; cycleCounter.defaultRotation = defaultRotation; //Debug.Log("altimeter Counter list: " + analogCounter.wheels.Count); maintenanceInfo = part.Modules.OfType <FSmaintenanceInfo>().FirstOrDefault(); if (maintenanceInfo != null) { flightTime = maintenanceInfo.flightTime; cycles = maintenanceInfo.cycles; } cycleButton = base.internalProp.FindModelTransform(cycleButtonName).gameObject; cycleButtonHandler = cycleButton.AddComponent <FSgenericButtonHandler>(); cycleButtonHandler.mouseDownFunction = addCycle; }
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 void Start() { if (HighLogic.LoadedSceneIsFlight) { try { button = internalProp.FindModelTransform(buttonName).gameObject; buttonHandler = button.AddComponent<FSgenericButtonHandler>(); buttonHandler.mouseDownFunction = nextEngine; engineSelectionDialTransform = internalModel.FindModelTransform(engineSelectionDialName); engineSelectionDial = new Firespitter.cockpit.AnalogCounter(engineSelectionDialTransform, selectionDefaultRotation, selectionRotationAxis); } catch { //useEngineSelection = false; Debug.Log("FStachometer: No button or dial, disabling engine selection"); } RPMneedle = internalProp.FindModelTransform(RPMneedleName); heatNeedle = internalProp.FindModelTransform(heatNeedleName); thrustLimitNeedle = internalProp.FindModelTransform(thrustLimitNeedleName); } }
public void Start() { if (HighLogic.LoadedSceneIsFlight) { try { button = internalProp.FindModelTransform(buttonName).gameObject; buttonHandler = button.AddComponent <FSgenericButtonHandler>(); buttonHandler.mouseDownFunction = nextEngine; engineSelectionDialTransform = internalModel.FindModelTransform(engineSelectionDialName); engineSelectionDial = new Firespitter.cockpit.AnalogCounter(engineSelectionDialTransform, selectionDefaultRotation, selectionRotationAxis); } catch { //useEngineSelection = false; Debug.Log("FStachometer: No button or dial, disabling engine selection"); } RPMneedle = internalProp.FindModelTransform(RPMneedleName); heatNeedle = internalProp.FindModelTransform(heatNeedleName); thrustLimitNeedle = internalProp.FindModelTransform(thrustLimitNeedleName); } }
//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"); } }
public void Start() { switch (groupName) { case "Gear": actionGroup = KSPActionGroup.Gear; break; case "Brakes": actionGroup = KSPActionGroup.Brakes; break; case "Light": actionGroup = KSPActionGroup.Light; break; case "RCS": actionGroup = KSPActionGroup.RCS; break; case "SAS": actionGroup = KSPActionGroup.SAS; break; case "Stage": customAction = true; //actionGroup = KSPActionGroup.Stage; break; case "Abort": actionGroup = KSPActionGroup.Abort; break; case "Custom01": actionGroup = KSPActionGroup.Custom01; break; case "Custom02": actionGroup = KSPActionGroup.Custom02; break; case "Custom03": actionGroup = KSPActionGroup.Custom03; break; case "Custom04": actionGroup = KSPActionGroup.Custom04; break; case "Custom05": actionGroup = KSPActionGroup.Custom05; break; case "Custom06": actionGroup = KSPActionGroup.Custom06; break; case "Custom07": actionGroup = KSPActionGroup.Custom07; break; case "Custom08": actionGroup = KSPActionGroup.Custom08; break; case "Custom09": actionGroup = KSPActionGroup.Custom09; break; case "Custom10": actionGroup = KSPActionGroup.Custom10; break; default: customAction = true; break; } actionGroupNumber = BaseAction.GetGroupIndex(actionGroup); switchObjectTransform = base.internalProp.FindModelTransform(switchObjectName); buttonObject = base.internalProp.FindModelTransform(buttonTrigger).gameObject; buttonHandler = buttonObject.AddComponent<FSgenericButtonHandler>(); buttonHandler.mouseDownFunction = buttonClick; //buttonObject.AddComponent<FSswitchButtonHandler>(); //buttonObject.GetComponent<FSswitchButtonHandler>().buttonNumber = 1; //buttonObject.GetComponent<FSswitchButtonHandler>().target = base.internalProp.gameObject; try { switchTypeEnum = (SwitchType) Enum.Parse(typeof(SwitchType), switchType, true); } catch { switchTypeEnum = SwitchType.undefined; } }
public void Start() { switch (groupName) { case "Gear": actionGroup = KSPActionGroup.Gear; break; case "Brakes": actionGroup = KSPActionGroup.Brakes; break; case "Light": actionGroup = KSPActionGroup.Light; break; case "RCS": actionGroup = KSPActionGroup.RCS; break; case "SAS": actionGroup = KSPActionGroup.SAS; break; case "Stage": customAction = true; //actionGroup = KSPActionGroup.Stage; break; case "Abort": actionGroup = KSPActionGroup.Abort; break; case "Custom01": actionGroup = KSPActionGroup.Custom01; break; case "Custom02": actionGroup = KSPActionGroup.Custom02; break; case "Custom03": actionGroup = KSPActionGroup.Custom03; break; case "Custom04": actionGroup = KSPActionGroup.Custom04; break; case "Custom05": actionGroup = KSPActionGroup.Custom05; break; case "Custom06": actionGroup = KSPActionGroup.Custom06; break; case "Custom07": actionGroup = KSPActionGroup.Custom07; break; case "Custom08": actionGroup = KSPActionGroup.Custom08; break; case "Custom09": actionGroup = KSPActionGroup.Custom09; break; case "Custom10": actionGroup = KSPActionGroup.Custom10; break; default: customAction = true; break; } actionGroupNumber = BaseAction.GetGroupIndex(actionGroup); switchObjectTransform = base.internalProp.FindModelTransform(switchObjectName); buttonObject = base.internalProp.FindModelTransform(buttonTrigger).gameObject; buttonHandler = buttonObject.AddComponent <FSgenericButtonHandler>(); buttonHandler.mouseDownFunction = buttonClick; //buttonObject.AddComponent<FSswitchButtonHandler>(); //buttonObject.GetComponent<FSswitchButtonHandler>().buttonNumber = 1; //buttonObject.GetComponent<FSswitchButtonHandler>().target = base.internalProp.gameObject; try { switchTypeEnum = (SwitchType)Enum.Parse(typeof(SwitchType), switchType, true); } catch { switchTypeEnum = SwitchType.undefined; } }