示例#1
0
    protected void OnAddNpcs()
    {
        List <NPC> npcs = GameCenter.curGameStage.GetNPCs();

        for (int i = 0; i < npcs.Count; i++)
        {
            NPC instance = npcs[i];
            if (npcPointDic.ContainsKey(instance.id) || instance.isDead)
            {
                continue;
            }
            GameObject myPoint = Instantiate(npcPointInstance) as GameObject;
            myPoint.transform.parent        = mapCtrl;
            myPoint.transform.localScale    = Vector3.one;
            myPoint.transform.localPosition = new Vector3(instance.curSector.c * Mathf.PI, instance.curSector.r * Mathf.PI, 0);
            SmartActorMapPoint p = myPoint.AddComponent <SmartActorMapPoint>();
            p.SetTarget(instance);
            npcPointDic.Add(instance.id, myPoint);
        }
    }
示例#2
0
    protected void InitMap()
    {
        if (manName != null)
        {
            manName.text = GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneRef.name;
        }
        if (mapCtrl != null)
        {
            mapCtrl.localPosition = new Vector3(mapCtrlOriginPos.x - mainPlayer.curSector.c * Mathf.PI + mapFrameScale.x / 2.0f, mapCtrlOriginPos.y - mainPlayer.curSector.r * Mathf.PI + mapFrameScale.y / 2.0f, 0);
        }
        List <Monster> mobs = GameCenter.curGameStage.GetMobs();

        for (int i = 0; i < mobs.Count; i++)
        {
            Monster instance = mobs[i];
            if (mobPointDic.ContainsKey(instance.id) || instance.isDead)
            {
                continue;
            }
            GameObject myPoint = Instantiate(mobPointInstance) as GameObject;
            myPoint.transform.parent        = mapCtrl;
            myPoint.transform.localScale    = Vector3.one;
            myPoint.transform.localPosition = new Vector3(instance.curSector.c * Mathf.PI, instance.curSector.r * Mathf.PI, 0);
            SmartActorMapPoint p = myPoint.AddComponent <SmartActorMapPoint>();
            p.SetTarget(instance);
            mobPointDic.Add(instance.id, myPoint);
        }
        List <NPC> npcs = GameCenter.curGameStage.GetNPCs();

        for (int i = 0; i < npcs.Count; i++)
        {
            NPC instance = npcs[i];
            if (npcPointDic.ContainsKey(instance.id))
            {
                continue;
            }
            GameObject myPoint = Instantiate(npcPointInstance) as GameObject;
            myPoint.transform.parent        = mapCtrl;
            myPoint.transform.localScale    = Vector3.one;
            myPoint.transform.localPosition = new Vector3(instance.curSector.c * Mathf.PI, instance.curSector.r * Mathf.PI, 0);
            SmartActorMapPoint p = myPoint.AddComponent <SmartActorMapPoint>();
            p.SetTarget(instance);
            npcPointDic.Add(instance.id, myPoint);
        }
        List <FlyPoint> flys = GameCenter.curGameStage.GetFlypoints();

        for (int i = 0; i < flys.Count; i++)
        {
            FlyPoint instance = flys[i];
            if (flyPointDic.ContainsKey(instance.id))
            {
                continue;
            }
            GameObject myPoint = Instantiate(flyPointInstance) as GameObject;
            myPoint.transform.parent        = mapCtrl;
            myPoint.transform.localScale    = Vector3.one;
            myPoint.transform.localPosition = new Vector3(instance.curSector.c * Mathf.PI, instance.curSector.r * Mathf.PI, 0);
            flyPointDic.Add(instance.id, myPoint);
        }
        LimitMapCtr();
    }