예제 #1
0
    // -- Scene 전환 관련 정리 ----------------------------------------------------------------//
    public void ChangeScene(PLACE place, GameObject funcTarget = null, string func = null, bool fadeOutEndFunc = true)
    {
        if (m_place == PLACE.ONLY_POPUP_SHOW && place == PLACE.ROBO_IN)
        {
            NetworkManager.Instance().GameStart();
        }

        m_place = place;

        PLACE_INFO info = m_placeList[(int)place];

        m_moveTarget             = info.targetObject;
        m_targetPlace            = info.place;
        m_backgroundObj          = info.backgroundObj;
        Camera.main.orthographic = true;

        m_moveCamera.CORRECTION = Vector2.zero;
        m_moveCamera.m_target   = null;

        m_funcTarget     = funcTarget;
        m_func           = func;
        m_faceOutEndFunc = fadeOutEndFunc;

        m_moveCamera.TARGET_MOVEABLE = false;
        switch (place)
        {
        case PLACE.STAGE1_BOSS:
            SoundManager.Instance().PlayBGM(4);
            break;

        case PLACE.PLANET:
            if (!NetworkOrderController.OBSERVER_MODE)
            {
                m_moveTarget = GameManager.Instance().PLAYER.PLAYER_HERO.gameObject;
            }
            m_moveCamera.CORRECTION = new Vector2(0.0f, 5.5f);
            break;

        case PLACE.PLANET2:
        case PLACE.PLANET1:
            SoundManager.Instance().PlayBGM(3);
            if (!NetworkOrderController.OBSERVER_MODE)
            {
                m_moveTarget = GameManager.Instance().PLAYER.PLAYER_HERO.gameObject;
            }
            m_moveCamera.TARGET_MOVEABLE = true;
            m_moveCamera.CORRECTION      = new Vector2(0.0f, 6.0f);
            break;

        case PLACE.ROBO_IN_DRIVE:
        case PLACE.ROBO_IN_GUN:
        case PLACE.ROBO_IN:
            NetworkManager.Instance().SendOrderMessage(
                JSONMessageTool.ToJsonEnergyUdate("robo", ROBO.ENERGY));
            SoundManager.Instance().PlayBGM(2);
            if (!NetworkOrderController.OBSERVER_MODE)
            {
                m_moveTarget = GameManager.Instance().PLAYER.PLAYER_HERO.gameObject;
            }
            m_moveCamera.CORRECTION      = new Vector2(0.0f, 5.76f);
            m_moveCamera.TARGET_MOVEABLE = true;
            break;

        case PLACE.ROBO:
            m_backgroundObj =
                (CUR_PLACE == ROBO_PLACE.SPACE) ?
                m_placeList[(int)PLACE.SPACE].backgroundObj :
                m_placeList[(int)PLACE.STAGE1_BOSS].backgroundObj;
            m_moveTarget = m_targetPlace;
            break;

        case PLACE.TUTORIAL_START:
            m_targetPlace.transform.parent.parent.SendMessage("SetupTutorial");
            m_moveCamera.TARGET_MOVEABLE = true;
            break;
        }

        CameraFadeOut();

        if (!NetworkOrderController.OBSERVER_MODE)
        {
            NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonUserPlaceChange((int)m_place));
        }
    }