当前位置: 首页>>代码示例>>C#>>正文


C# StaticObject.GetDistanceToObject方法代码示例

本文整理汇总了C#中KerbalKonstructs.StaticObjects.StaticObject.GetDistanceToObject方法的典型用法代码示例。如果您正苦于以下问题:C# StaticObject.GetDistanceToObject方法的具体用法?C# StaticObject.GetDistanceToObject怎么用?C# StaticObject.GetDistanceToObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KerbalKonstructs.StaticObjects.StaticObject的用法示例。


在下文中一共展示了StaticObject.GetDistanceToObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: drawRacingWindow

        public void drawRacingWindow(int windowID)
        {
            BoxNoBorder = new GUIStyle(GUI.skin.box);
            BoxNoBorder.normal.background = null;
            BoxNoBorder.normal.textColor = Color.white;

            BoxNoBorderS = new GUIStyle(GUI.skin.box);
            BoxNoBorderS.normal.background = null;
            BoxNoBorderS.normal.textColor = Color.white;
            BoxNoBorderS.fontSize = 13;

            DeadButton = new GUIStyle(GUI.skin.button);
            DeadButton.normal.background = null;
            DeadButton.hover.background = null;
            DeadButton.active.background = null;
            DeadButton.focused.background = null;
            DeadButton.normal.textColor = Color.white;
            DeadButton.hover.textColor = Color.white;
            DeadButton.active.textColor = Color.white;
            DeadButton.focused.textColor = Color.white;
            DeadButton.fontSize = 14;
            DeadButton.fontStyle = FontStyle.Bold;

            DeadButtonRed = new GUIStyle(GUI.skin.button);
            DeadButtonRed.normal.background = null;
            DeadButtonRed.hover.background = null;
            DeadButtonRed.active.background = null;
            DeadButtonRed.focused.background = null;
            DeadButtonRed.normal.textColor = Color.red;
            DeadButtonRed.hover.textColor = Color.yellow;
            DeadButtonRed.active.textColor = Color.red;
            DeadButtonRed.focused.textColor = Color.red;
            DeadButtonRed.fontSize = 12;
            DeadButtonRed.fontStyle = FontStyle.Bold;

            GUILayout.BeginHorizontal();
            {
                GUI.enabled = false;
                GUILayout.Button("-KK-", DeadButton, GUILayout.Height(16));

                GUILayout.FlexibleSpace();
                if (basicorbitalhud)
                    GUILayout.Button("Orbital Data", DeadButton, GUILayout.Height(16));
                else
                    GUILayout.Button("Air-Racing", DeadButton, GUILayout.Height(16));

                GUILayout.FlexibleSpace();

                GUI.enabled = true;

                if (GUILayout.Button("X", DeadButtonRed, GUILayout.Height(16)))
                {
                    ResetRace();
                    KerbalKonstructs.instance.showRacingApp = false;
                    runningRace = false;
                    basicorbitalhud = false;
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(1);
            GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));

            if (basicorbitalhud)
            {
                string sBody = FlightGlobals.ActiveVessel.mainBody.name;
                double dPeriapsis = FlightGlobals.ActiveVessel.orbit.PeA;
                double dApoapsis = FlightGlobals.ActiveVessel.orbit.ApA;
                double dInclination = FlightGlobals.ActiveVessel.orbit.inclination;
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Box("SOI: " + sBody, BoxNoBorder, GUILayout.Width(75));
                    GUILayout.FlexibleSpace();
                    GUILayout.Box("Periapsis " + (dPeriapsis/1000).ToString("#0.0") + " km", BoxNoBorder, GUILayout.Width(90));
                    GUILayout.FlexibleSpace();
                    GUILayout.Box("Apoapsis " + (dApoapsis/1000).ToString("#0.0") + " km", BoxNoBorder, GUILayout.Width(90));
                    GUILayout.FlexibleSpace();
                    GUILayout.Box("Inclination " + dInclination.ToString("#0.00") + "°", BoxNoBorder, GUILayout.Width(80));
                }
                GUILayout.EndHorizontal();
            }
            else
            {

                if (!racing)
                {
                    GUILayout.Box("Cross a start line to begin a race.");

                    if (!started)
                    {
                        StartLine = NavUtils.GetNearestFacility(FlightGlobals.ActiveVessel.GetTransform().position, "RaceStart");
                        if (StartLine != null)
                        {
                            fDistToStart = StartLine.GetDistanceToObject(FlightGlobals.ActiveVessel.GetTransform().position);

                            if (fDistToStart < 150)
                            {
                                dStartTime = Planetarium.GetUniversalTime();
                                MiscUtils.HUDMessage("!!! GO GO GO !!!", 10, 0);
                                started = true;
//.........这里部分代码省略.........
开发者ID:AlphaAsh,项目名称:Kerbal-Konstructs_DEV,代码行数:101,代码来源:AirRacing.cs


注:本文中的KerbalKonstructs.StaticObjects.StaticObject.GetDistanceToObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。