Example #1
0
    private void Select_Star(Star star)
    {
        CameraController.focus_Level focus_Level = CameraController.Get_Focus_Level();
        GameObject cameraTarget = null;

        if (focus_Level == CameraController.focus_Level.NONE)
        {
            Select_New_Star(star);
        }

        if (focus_Level == CameraController.focus_Level.STAR)
        {
            Star prevStar = null;

            if (current_Object)
            {
                prevStar = current_Object.GetComponent <Star>();
            }

            if (prevStar)
            {
                if (prevStar == star)
                {
                    cameraTarget = CameraController.target;

                    if (cameraTarget)                                           //The camera has a target
                    {
                        if (cameraTarget != star.gameObject)                    //The camera target is not this star
                        {
                            CameraController.SetTarget(star.gameObject);
                            ui_Selector.Set_Mini_Position(star.gameObject.transform.position);
                            ui_Selector.Deactivate_Mini_Indicator();
                        }

                        else
                        {
                            StarToSystem(star);                                 //The camera target and previous target are this star (Double click)
                        }
                    }

                    CameraController.SetTarget(star.gameObject);                //The previous object is thist star, but not the camera target. Make this object the camera target
                }

                else
                {
                    Select_New_Star(star);                                      //Previously selected star is not this star
                }
            }

            else
            {
                Select_New_Star(star);
            }                                                                   //No previously selected star
        }

        if (focus_Level == CameraController.focus_Level.SYSTEM)
        {
            Star prevStar = null;

            if (current_Object)
            {
                prevStar = current_Object.GetComponent <Star>();
            }

            if (prevStar)                                                       //Previous Object was a Star
            {
                if (prevStar != star)                                           //Previous Object was not this Star
                {
                    Select_New_Star(star);
                }

                else
                {
                    ZoomToStar(star);                                 //Previous Object was this star
                }
            }
        }

        if (focus_Level == CameraController.focus_Level.PLANET)         //Peevious object was a planet
        {
            Planet prevPlanet = null;
            Star   hostStar   = null;

            if (current_Object)
            {
                prevPlanet = current_Object.GetComponent <Planet>();
            }

            if (prevPlanet)                                             //Prev object was a planet
            {
                hostStar = prevPlanet.Get_Star();

                if (hostStar != star)                                   //Previous Host Star was not this Star
                {
                    Select_New_Star(star);
                }

                else                                                    //Previous Host Star was this Star
                {                                                       //Same as zoom to star without the zooming or re-org of planet manager
                    Planet_Manager.ringState current = GetComponentInChildren <Planet_Manager>().Get_Current_RingState();

                    if (current == Planet_Manager.ringState.STAR)
                    {
                        current_Object = this;
                        ui_Selector.Select_Star(star);
                        CameraController.Set_Focus_Level(CameraController.focus_Level.STAR);
                        //CameraController.SetTarget(star.gameObject);
                    }

                    else
                    {
                        current_Object = this;
                        ui_Selector.Select_System(star);
                        CameraController.Set_Focus_Level(CameraController.focus_Level.SYSTEM);
                        CameraController.SetTarget(star.gameObject);
                    }
                }
            }
        }

        if (focus_Level == CameraController.focus_Level.SURFACE)
        {
        }
    }