コード例 #1
0
        private void DrawLines(Part draw, WingStats wing, Color color, bool drawTransform = true)
        {
            Vector3 leadRoot  = draw.transform.position + draw.transform.TransformDirection(wing.rootMidChordOffset + Vector3.up * wing.rootChordLength / 2);
            Vector3 trailRoot = draw.transform.position + draw.transform.TransformDirection(wing.rootMidChordOffset - Vector3.up * wing.rootChordLength / 2);

            Vector3 leadTip  = draw.transform.position + draw.transform.TransformDirection(wing.tipMidChordOffset + Vector3.up * wing.tipChordLength / 2);
            Vector3 trailTip = draw.transform.position + draw.transform.TransformDirection(wing.tipMidChordOffset - Vector3.up * wing.tipChordLength / 2);

            DrawTools.DrawLine(leadRoot, trailRoot, color);
            DrawTools.DrawLine(leadTip, trailTip, color);
            if (drawTransform)
            {
                DrawTools.DrawTransform(draw.transform, 0.25f);
            }
        }
コード例 #2
0
        private DialogGUIVerticalLayout DrawWingSettings(float labelWidth, WingStats wing, bool alwaysOn = true, Func <bool> isOn = null)
        {
            var settings = new DialogGUIVerticalLayout();

            // Vertical and root settings
            settings.AddChild(SetFloatDialog(labelWidth, "Vertical Offset: ", () => { return(Format(wing.ZOffset)); },
                                             (string input) => { return(ProcessTextToFloat(input, wing.ZOffset, (float s) => { wing.ZOffset = s; })); },
                                             () => { return(deltaSize); }, (float change) => { wing.ZOffset += change; }));
            settings.AddChild(SetFloatDialog(labelWidth, "Length of Root Chord: ", () => { return(Format(wing.rootChordLength)); },
                                             (string input) => { return(ProcessTextToFloat(input, ref wing.rootChordLength)); },
                                             () => { return(deltaSize); }, (float change) => { wing.rootChordLength += change; }));
            settings.AddChild(SetFloatDialog(labelWidth, "Offset of Root Midpoint - X (Right+)", () => { return(Format(wing.rootMidChordOffset.x)); },
                                             (string input) => { return(ProcessTextToFloat(input, ref wing.rootMidChordOffset.x)); },
                                             () => { return(deltaSize); }, (float change) => { wing.rootMidChordOffset.x += change; }));
            settings.AddChild(SetFloatDialog(labelWidth, "Offset of Root Midpoint - Y (Forward+)", () => { return(Format(wing.rootMidChordOffset.y)); },
                                             (string input) => { return(ProcessTextToFloat(input, ref wing.rootMidChordOffset.y)); },
                                             () => { return(deltaSize); }, (float change) => { wing.rootMidChordOffset.y += change; }));

            settings.AddChild(new DialogGUISpace(5f));

            // Tip settings
            settings.AddChild(SetFloatDialog(labelWidth, "Length of Tip Chord: ", () => { return(Format(wing.tipChordLength)); },
                                             (string input) => { return(ProcessTextToFloat(input, ref wing.tipChordLength)); },
                                             () => { return(deltaSize); }, (float change) => { wing.tipChordLength += change; }));
            settings.AddChild(SetFloatDialog(labelWidth, "Offset of Tip Midpoint - X (Right+)", () => { return(Format(wing.tipMidChordOffset.x)); },
                                             (string input) => { return(ProcessTextToFloat(input, ref wing.tipMidChordOffset.x)); },
                                             () => { return(deltaSize); }, (float change) => { wing.tipMidChordOffset.x += change; }));
            settings.AddChild(SetFloatDialog(labelWidth, "Offset of Tip Midpoint - Y (Forward+)", () => { return(Format(wing.tipMidChordOffset.y)); },
                                             (string input) => { return(ProcessTextToFloat(input, ref wing.tipMidChordOffset.y)); },
                                             () => { return(deltaSize); }, (float change) => { wing.tipMidChordOffset.y += change; }));

            if (!alwaysOn)
            {
                foreach (DialogGUIBase dialog in settings.children)
                {
                    settings.OptionEnabledCondition = isOn;
                }
            }

            return(settings);
        }