public static EntityMonsterBeacon CreateMonsterBeaconBySweepID(List <int> sweepDataId, Transform targetTrans,
                                                                   TowerInfoUIData uiData, int preTime, int entityId = -1, TypeTowerDefendsData data = null, int releaseNpcid = -1)
    {
        GameObject go = new GameObject("MonsterBeacon");

        Vector3 v = new Vector3();

        if (null != data)
        {
            switch (data.m_Pos.type)
            {
            case TypeTowerDefendsData.PosType.getPos:
                v = PeCreature.Instance.mainPlayer.position;
                break;

            case TypeTowerDefendsData.PosType.pos:
                v = data.m_Pos.pos;
                break;

            case TypeTowerDefendsData.PosType.npcPos:
                v = EntityMgr.Instance.Get(data.m_Pos.id).position;
                break;

            case TypeTowerDefendsData.PosType.doodadPos:
                v = EntityMgr.Instance.GetDoodadEntities(data.m_Pos.id)[0].position;
                break;

            case TypeTowerDefendsData.PosType.conoly:
                if (!CSMain.GetAssemblyPos(out v))
                {
                    v = PeCreature.Instance.mainPlayer.position;
                }
                break;

            case TypeTowerDefendsData.PosType.camp:
                if (VArtifactUtil.GetTownPos(data.m_Pos.id, out v))
                {
                    v = PeCreature.Instance.mainPlayer.position;
                }
                break;

            default:
                break;
            }
            data.finallyPos = v;
        }
        go.transform.position = v;

        AISpawnTDWavesData.TDWaveSpData spData = MonsterSweepData.GetWaveSpData(sweepDataId, v);
        if (spData == null)
        {
            return(null);
        }

        EntityMonsterBeacon bcn = go.AddComponent <EntityMonsterBeacon>();

        bcn.isSweep = true;
        EntityMgr.Instance.AddAfterAssignId(bcn, entityId != -1 ? entityId : Pathea.WorldInfoMgr.Instance.FetchNonRecordAutoId());
        bcn._uiData   = uiData;
        bcn._spData   = spData;
        bcn._position = v;
        bcn._forward  = Vector3.forward;
        bcn.PreTime   = (float)(preTime + spData._waveDatas[0]._delayTime);
        if (UITowerInfo.Instance != null && uiData != null)
        {
            UITowerInfo.Instance.SetInfo(uiData);
            UITowerInfo.Instance.Show();
            UITowerInfo.Instance.e_BtnReady += () => { bcn.PreTime = 0; };
        }

        bcn.StartCoroutine(bcn.RefreshTowerMission());
        return(bcn);
    }
    public static EntityMonsterBeacon CreateMonsterBeaconByTDID(int spDataId, Transform targetTrans,
                                                                TowerInfoUIData uiData, int entityId = -1, TypeTowerDefendsData data = null, int releaseNpcid = -1, bool bOnlyMonster = false)
    {
        // Get type mask
        int        campCol    = -1;
        List <int> spawnTypes = GetSpawnTypeMask(bOnlyMonster, out campCol);

        AISpawnTDWavesData.TDWaveSpData spData = AISpawnTDWavesData.GetWaveSpData(spDataId, UnityEngine.Random.value, spawnTypes);
        if (spData == null)
        {
            return(null);
        }

        GameObject go = new GameObject("MonsterBeacon");
        Vector3    v  = new Vector3();

        if (null != data)
        {
            switch (data.m_Pos.type)
            {
            case TypeTowerDefendsData.PosType.getPos:
                v = PeCreature.Instance.mainPlayer.position;
                break;

            case TypeTowerDefendsData.PosType.pos:
                v = data.m_Pos.pos;
                break;

            case TypeTowerDefendsData.PosType.npcPos:
                v = EntityMgr.Instance.Get(data.m_Pos.id).position;
                break;

            case TypeTowerDefendsData.PosType.doodadPos:
                v = EntityMgr.Instance.GetDoodadEntities(data.m_Pos.id)[0].position;
                break;

            case TypeTowerDefendsData.PosType.conoly:
                if (!CSMain.GetAssemblyPos(out v))
                {
                    v = PeCreature.Instance.mainPlayer.position;
                }
                break;

            case TypeTowerDefendsData.PosType.camp:
                if (!VArtifactUtil.GetTownPos(data.m_Pos.id, out v))
                {
                    v = PeCreature.Instance.mainPlayer.position;
                }
                break;

            default:
                break;
            }
            data.finallyPos = v;

            go.transform.position = v;
            go.transform.rotation = Quaternion.identity;
        }
        else if (targetTrans != null)
        {
            v = targetTrans.position;
            go.transform.position = targetTrans.position;
            go.transform.rotation = targetTrans.rotation;
        }
        EntityMonsterBeacon bcn = go.AddComponent <EntityMonsterBeacon>();

        EntityMgr.Instance.AddAfterAssignId(bcn, entityId != -1 ? entityId : Pathea.WorldInfoMgr.Instance.FetchNonRecordAutoId());
        bcn._campCol  = campCol;
        bcn._uiData   = uiData;
        bcn._spData   = spData;
        bcn._spDataId = spDataId;
        bcn._position = go.transform.position;
        bcn._forward  = go.transform.forward;
        bcn.PreTime   = (float)(spData._timeToStart + spData._waveDatas[0]._delayTime);

        if (UITowerInfo.Instance != null && uiData != null)
        {
            UITowerInfo.Instance.SetInfo(uiData);
            UITowerInfo.Instance.Show();
            UITowerInfo.Instance.e_BtnReady += () => { bcn.PreTime = 0; };
        }

        bcn.StartCoroutine(bcn.RefreshTowerMission());
        return(bcn);
    }