Exemple #1
0
 void Clear()
 {
     npcNode           = null;
     mapInfoNode       = null;
     sEFIndexNode      = null;
     collectNode       = null;
     mapId             = 0;
     mapName           = "";
     fileName          = "";
     currentSceneName  = "";
     currentSceneMapid = 0;
     toSceneTransID    = 0;
 }
Exemple #2
0
    public static void  Create(ScenceElementFileIndexTableNode miniMapInfo)
    {
        GameObject obj     = Instantiate(Resources.Load("Prefab/miniMap/miniMapCamera")) as GameObject;
        GameObject objShow = Instantiate(Resources.Load("Prefab/miniMap/miniMapShow")) as GameObject;

        objShow.transform.position      = miniMapInfo.pos;
        objShow.transform.localRotation = Quaternion.Euler(miniMapInfo.rot);
        objShow.transform.localScale    = miniMapInfo.scale;
        objShow.name = "miniMapShow";
        Material [] tempM = new Material [objShow.GetComponent <MeshRenderer>().materials.Length];
        Texture     tempT = Instantiate(Resources.Load("Prefab/miniMap/" + miniMapInfo.MiniMapId)) as Texture;

        objShow.GetComponent <MeshRenderer>().materials [0].mainTexture = tempT;
        obj.AddComponent <MiniMap>();
        obj.GetComponent <MiniMap>().miniMapInfo = miniMapInfo;
    }
Exemple #3
0
    long toSceneTransID     = 0;  //当前场景到目的场景的传送id
    #endregion

    /// <summary>
    /// 任务移动接口
    /// </summary>
    /// <param name="id">npcID 或 怪物id 或采集点id 或传送门id</param>
    /// <param name="moveType"></param>
    /// <param name="mapID"></param>
    public void MoveToTargetPosition(long id, TaskMoveTarget moveType, int mapID = 0)
    {
        Clear();
        TaskManager.Single().taskAutoTraceID = id;
        TaskManager.Single().taskMoveType    = moveType;
        TaskManager.Single().maiID           = mapID;
        //通过这个id,查表 一步一步找到目标位置
        if (moveType == TaskMoveTarget.MoveToNpc) //npc
        {
            //先跳转到npc场景,然后在寻找npc位置,然后移动到npc位置
            if (FSDataNodeTable <NPCNode> .GetSingleton().DataNodeList.ContainsKey(id))
            {
                npcID   = id;
                npcNode = FSDataNodeTable <NPCNode> .GetSingleton().DataNodeList[id];

                mapId = npcNode.mapid;
                if (FSDataNodeTable <MapInfoNode> .GetSingleton().DataNodeList.ContainsKey(mapId))
                {
                    mapInfoNode = FSDataNodeTable <MapInfoNode> .GetSingleton().DataNodeList[mapId];//场景属性表

                    mapName = mapInfoNode.MapName;

                    mapInfo = mapInfoNode.map_info;
                    if (FSDataNodeTable <ScenceElementFileIndexTableNode> .GetSingleton().DataNodeList.ContainsKey(mapInfo))
                    {
                        sEFIndexNode = FSDataNodeTable <ScenceElementFileIndexTableNode> .GetSingleton().DataNodeList[mapInfo];//场景元素索引表

                        fileName = sEFIndexNode.filename;
                    }
                    //直接遍历场景元素表 去找位置了
                    TaskManager.Single().posList.Clear();
                    if (fileName == "")
                    {
                        return;
                    }
                    foreach (SceneMapNode mapNode in FSDataNodeTable <SceneMapNode> .GetSingleton().DataNodeLists[fileName].Values)
                    {
                        if (mapNode.type_id == (long)id)
                        {
                            TaskManager.Single().posList.Add(mapNode.pos);
                        }
                    }
                    FindTargetPosition();
                }
            }
        }
        else if (moveType == TaskMoveTarget.MoveToCollectPos)//采集点
        {
            //先跳转到采集物所在场景,然后在再寻找采集物位置,然后移动到采集物位置
            if (FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList.ContainsKey(id))
            {
                collectNode = FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[id];

                mapId = collectNode.mapid;
                if (FSDataNodeTable <MapInfoNode> .GetSingleton().DataNodeList.ContainsKey(mapId))
                {
                    mapInfoNode = FSDataNodeTable <MapInfoNode> .GetSingleton().DataNodeList[mapId];//场景属性表

                    mapName = mapInfoNode.MapName;

                    mapInfo = mapInfoNode.map_info;
                    if (FSDataNodeTable <ScenceElementFileIndexTableNode> .GetSingleton().DataNodeList.ContainsKey(mapInfo))
                    {
                        sEFIndexNode = FSDataNodeTable <ScenceElementFileIndexTableNode> .GetSingleton().DataNodeList[mapInfo];//场景元素索引表

                        fileName = sEFIndexNode.filename;
                    }
                    //直接遍历场景元素表 去找位置了
                    TaskManager.Single().posList.Clear();
                    if (fileName == "")
                    {
                        return;
                    }
                    foreach (SceneMapNode mapNode in FSDataNodeTable <SceneMapNode> .GetSingleton().DataNodeLists[fileName].Values)
                    {
                        if (mapNode.type_id == (long)id)
                        {
                            TaskManager.Single().posList.Add(mapNode.pos);
                        }
                    }
                    FindTargetPosition();
                }
            }
        }
        else if (moveType == TaskMoveTarget.MoveToMonsterDropPis)
        {
            //怪物掉落物 传过来的采采集表的id,然后通过采集表找到怪物id 和 mapId ---确定怪物的位置
            //先跳转到怪物掉落物地点,然后在寻找怪物掉落点位置,然后移动到该位置
            if (FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList.ContainsKey(id))
            {
                collectNode = FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[id];

                long monsterID = collectNode.monsterid;
                mapId = collectNode.mapid;
                if (FSDataNodeTable <MapInfoNode> .GetSingleton().DataNodeList.ContainsKey(mapId))
                {
                    mapInfoNode = FSDataNodeTable <MapInfoNode> .GetSingleton().DataNodeList[mapId];//场景属性表

                    mapName = mapInfoNode.MapName;

                    mapInfo = mapInfoNode.map_info;
                    if (FSDataNodeTable <ScenceElementFileIndexTableNode> .GetSingleton().DataNodeList.ContainsKey(mapInfo))
                    {
                        sEFIndexNode = FSDataNodeTable <ScenceElementFileIndexTableNode> .GetSingleton().DataNodeList[mapInfo];//场景元素索引表

                        fileName = sEFIndexNode.filename;
                    }
                    //直接遍历场景元素表 去找位置了
                    TaskManager.Single().posList.Clear();
                    if (fileName == "")
                    {
                        return;
                    }
                    foreach (SceneMapNode mapNode in FSDataNodeTable <SceneMapNode> .GetSingleton().DataNodeLists[fileName].Values)
                    {
                        if (mapNode.type_id == monsterID)//怪物掉落物 传进来的id是采集表id,通过采集表id在采集表中得到怪物id,然后通过怪物id在相应的元素表中找到怪物位置
                        {
                            TaskManager.Single().posList.Add(mapNode.pos);
                        }
                    }
                    FindTargetPosition();
                }
            }
        }
        else if (moveType == TaskMoveTarget.MoveToMonsterPos)
        {
            //先跳转到怪物地点,然后在寻找怪物位置,然后移动到该位置
            long monsterID = id;
            mapId = mapID;// 去野外杀怪  告诉我野外mapid
            if (FSDataNodeTable <MapInfoNode> .GetSingleton().DataNodeList.ContainsKey(mapId))
            {
                mapInfoNode = FSDataNodeTable <MapInfoNode> .GetSingleton().DataNodeList[mapId];//场景属性表

                mapName = mapInfoNode.MapName;

                mapInfo = mapInfoNode.map_info;
                if (FSDataNodeTable <ScenceElementFileIndexTableNode> .GetSingleton().DataNodeList.ContainsKey(mapInfo))
                {
                    sEFIndexNode = FSDataNodeTable <ScenceElementFileIndexTableNode> .GetSingleton().DataNodeList[mapInfo];//场景元素索引表

                    fileName = sEFIndexNode.filename;
                }
                //直接遍历场景元素表 去找位置了
                TaskManager.Single().posList.Clear();
                if (fileName == "")
                {
                    return;
                }
                foreach (SceneMapNode mapNode in FSDataNodeTable <SceneMapNode> .GetSingleton().DataNodeLists[fileName].Values)
                {
                    if (mapNode.type_id == monsterID)//怪物掉落物 传进来的id是采集表id,通过采集表id在采集表中得到怪物id,然后通过怪物id在相应的元素表中找到怪物位置
                    {
                        TaskManager.Single().posList.Add(mapNode.pos);
                    }
                }
                FindTargetPosition();
            }
        }

        StartMove();
    }