コード例 #1
0
        public References()
        {
            _screenSafeUi       = ScreenSafeUI.fetch;
            _flightUiController = _screenSafeUi.GetComponent <FlightUIController>();

            GameObject navballGameObject = GameObject.Find("NavBall");

            _navball               = navballGameObject.GetComponent <NavBall>();
            _navBallTexture        = _navball.navBall.renderer.sharedMaterial;
            _vectorsPivotTransform = navballGameObject.transform.FindChild("vectorsPivot");

            _antiNormalVector = _navball.antiNormalVector.gameObject;
            _normalVector     = _navball.normalVector.gameObject;
            _radialInVector   = _navball.radialInVector.gameObject;
            _radialOutVector  = _navball.radialOutVector.gameObject;

            ManeuverGizmo maneuverGizmo = MapView.ManeuverNodePrefab.GetComponent <ManeuverGizmo>();

            _maneuverTexture = maneuverGizmo.handleNormal.flag.renderer.sharedMaterial;

            var maneuverVector = GameObject.Find("maneuverVector");

            _navBallBurnVector = maneuverVector.GetComponent <NavBallBurnVector>();

            _manueverIndicationarrow = GameObject.Find("Indicationarrow");
        }
コード例 #2
0
        public static float GetNavballPostion()
        {
            ScreenSafeUI ui = References.Instance.ScreenSafeUi;

            if (ui == null)
            {
                return(0.5f);
            }

            return(ui.centerAnchor.bottom.position.x);
        }
コード例 #3
0
        public static void UpdateNavballPostion(
            ScreenSafeUI ui,
            float newX)
        {
            if (ui == null)
                return;

            ui.centerAnchor.bottom.position = new Vector3(
                newX,
                ui.centerAnchor.bottom.position.y,
                -0.01f);
        }
コード例 #4
0
        public static void UpdateNavballPostion(
            ScreenSafeUI ui,
            float newX)
        {
            if (ui == null)
            {
                return;
            }

            ui.centerAnchor.bottom.position = new Vector3(
                newX,
                ui.centerAnchor.bottom.position.y,
                -0.01f);
        }
コード例 #5
0
        public static float ResetNavballPostion()
        {
            ScreenSafeUI ui = References.Instance.ScreenSafeUi;

            if (ui == null)
            {
                return(0.5f);
            }

            Vector3 resetNavballPostion = (ui.leftAnchor.bottom.position + ui.rightAnchor.bottom.position) * 0.5f;

            ui.centerAnchor.bottom.position = resetNavballPostion;
            return(GetNavballPostion());
        }
コード例 #6
0
        /// <summary>
        /// sets screen space for SSUI system (main flight UI, parts of editor and main menu)
        /// </summary>
        public static void setUIAnchors()
        {
            ScreenSafeUI UI = ScreenSafeUI.fetch;

            // 1 unit = GameSettings.UI_Size
            if (UI.rightAnchor.bottom != null)
            {
                UI.rightAnchor.bottom.position = new Vector3((mainScreen.x + mainScreen.width) / GameSettings.UI_SIZE, 0, 0);
            }
            if (UI.centerAnchor.bottom != null)
            {
                UI.centerAnchor.bottom.position = new Vector3((mainScreen.x + 0.5f * mainScreen.width) / GameSettings.UI_SIZE, 0, 0);
            }
            if (UI.leftAnchor.bottom != null)
            {
                UI.leftAnchor.bottom.position = new Vector3(mainScreen.x / GameSettings.UI_SIZE, 0, 0);
            }
            if (UI.rightAnchor.center != null)
            {
                UI.rightAnchor.center.position = new Vector3((mainScreen.x + mainScreen.width) / GameSettings.UI_SIZE, (mainScreen.y + 0.5f * mainScreen.height) / GameSettings.UI_SIZE, 0);
            }
            if (UI.centerAnchor.center != null)
            {
                UI.centerAnchor.center.position = new Vector3((mainScreen.x + 0.5f * mainScreen.width) / GameSettings.UI_SIZE, (mainScreen.y + 0.5f * mainScreen.height) / GameSettings.UI_SIZE, 0);
            }
            if (UI.leftAnchor.center != null)
            {
                UI.leftAnchor.center.position = new Vector3(mainScreen.x / GameSettings.UI_SIZE, (mainScreen.y + 0.5f * mainScreen.height) / GameSettings.UI_SIZE, 0);
            }
            if (UI.rightAnchor.top != null)
            {
                UI.rightAnchor.top.position = new Vector3((mainScreen.x + mainScreen.width) / GameSettings.UI_SIZE, (mainScreen.y + mainScreen.height) / GameSettings.UI_SIZE, 0);
            }
            if (UI.centerAnchor.top != null)
            {
                UI.centerAnchor.top.position = new Vector3((mainScreen.x + 0.5f * mainScreen.width) / GameSettings.UI_SIZE, (mainScreen.y + mainScreen.height) / GameSettings.UI_SIZE, 0);
            }
            if (UI.leftAnchor.top != null)
            {
                UI.leftAnchor.top.position = new Vector3(mainScreen.x / GameSettings.UI_SIZE, (mainScreen.y + mainScreen.height) / GameSettings.UI_SIZE, 0);
            }
        }
コード例 #7
0
ファイル: References.cs プロジェクト: yaus/EnhancedNavBall
        public References()
        {
            _screenSafeUi = ScreenSafeUI.fetch;
            _flightUiController = _screenSafeUi.GetComponent<FlightUIController>();

            GameObject navballGameObject = GameObject.Find("NavBall");
            _navball = navballGameObject.GetComponent<NavBall>();
            _navBallTexture = _navball.navBall.renderer.sharedMaterial;
            _vectorsPivotTransform = navballGameObject.transform.FindChild("vectorsPivot");

            _antiNormalVector = _navball.antiNormalVector.gameObject;
            _normalVector = _navball.normalVector.gameObject;
            _radialInVector = _navball.radialInVector.gameObject;
            _radialOutVector = _navball.radialOutVector.gameObject;

            ManeuverGizmo maneuverGizmo = MapView.ManeuverNodePrefab.GetComponent<ManeuverGizmo>();
            _maneuverTexture = maneuverGizmo.handleNormal.flag.renderer.sharedMaterial;

            var maneuverVector = GameObject.Find("maneuverVector");
            _navBallBurnVector = maneuverVector.GetComponent<NavBallBurnVector>();

            _manueverIndicationarrow = GameObject.Find("Indicationarrow");
        }