Esempio n. 1
0
    /// <summary>
    /// 进入区域
    /// </summary>
    /// <param name="index"></param>
    private void EnterRegion(int index)
    {
        GameLevelRegionEntity entiy = GetRegionEntityByIndex(index);

        if (entiy == null)
        {
            return;
        }
        m_KillRegionMonsterCount = 0;
        int regionId = entiy.RegionId;

        m_CurRegionCtrl = GetRegionCtrlByRegionIndex(regionId);
        if (m_CurRegionCtrl == null)
        {
            return;
        }
        if (index == 0)
        {
            if (Global.Instance.CurPlayer != null)
            {
                Global.Instance.CurPlayer.Born(m_CurRegionCtrl.RoleBornPos.position);
                Global.Instance.CurPlayer.OnRoleDie = (ctrl) => { UIViewMgr.Instance.OpenView(UIViewType.GameLevelFail); };
            }
        }
        if (m_CurRegionCtrl.RegionMaskObj != null)
        {
            Destroy(m_CurRegionCtrl.RegionMaskObj);
        }
        //开启一下个区域的门
        if (index != 0)
        {
            GameLevelDoorCtrl door = m_CurRegionCtrl.GetNextRegionDoor(m_CurSelectRegionId);
            if (door != null)
            {
                if (door.m_ConenctDoor != null)
                {
                    door.m_ConenctDoor.gameObject.SetActive(false);
                }
                door.gameObject.SetActive(false);
            }
        }
        m_CurSelectRegionId         = regionId;
        m_CurrentRegionMonsterCount = GameLevelMonsterDBModel.Instance.GetRegionMonsterCount(m_GameLevelId, m_Grade, regionId);
        m_CurrentRegionMonsterList  = GameLevelMonsterDBModel.Instance.GetRegionAllMonsterInfo(m_GameLevelId, m_Grade, regionId);
        m_CurrentCreateCount        = 0;

        if (DelegateDefine.Instance.OnLoadSceneOK != null)
        {
            DelegateDefine.Instance.OnLoadSceneOK();
        }
    }