public void CreateObjectOnRenderControl(CreateObjType type, IPoint point)
        {
            switch (type)
            {
            case CreateObjType.CreateLabel:
                CreateLabel(point);
                break;

            case CreateObjType.CreateRenderModelPoint:
                CreateRenderModelPoint(point);
                break;

            case CreateObjType.CreateRenderPoint:
                CreateRenderPoint(point);
                break;

            case CreateObjType.CreateRenderPolyline:
                CreateRenderPolyline(point);
                break;

            case CreateObjType.CreateRenderPolygon:
                CreateRenderPolygon(point);
                break;

            default:
                break;
            }
        }
Example #2
0
    string GetTypeNameByObjectType(CreateObjType eType)
    {
        string sName = "";

        switch (eType)
        {
        case CreateObjType.eMonster:
            sName = "普通怪物";
            break;

        case CreateObjType.eFunNpc:
            sName = "功能Npc";
            break;

        case CreateObjType.eObj:
            sName = "OBJ";
            break;

        default:
            break;
        }
        return(sName);
    }
 //创建范围刷怪点
 public static GameObject AddPointNpc(float posx, float posy, float posz, int objId, CreateObjType eType, int rotation)
 {
     return(SceneEditorWindow._windowInstance.AddPointNpc(posx, posy, posz, objId, eType, rotation));
 }
    public GameObject AddPointNpc(float posx, float posy, float posz, int id, CreateObjType eType, int rotation)
    {
        GameObject obj = InstantiatePrefabWithpos(posx, posy, posz, ref PointBorn);

        obj.transform.SetParent(PointParent);
        obj.name = "定点刷怪点";

        if (eType == CreateObjType.eFunNpc)
        {
            FunNpcInfo funnpcinfo;
            if (EditerDataClass._Instance.GetFunNpcInfo().TryGetValue(id, out funnpcinfo))
            {
                BornInfo bornInfo = obj.GetComponent <BornInfo>();
                if (bornInfo != null)
                {
                    bornInfo.m_eObjType = 1;
                    bornInfo.me_Type    = CreateMode.enPointObj;
                    bornInfo.mi_ObjId   = id;
                    bornInfo.ms_Name    = funnpcinfo.name;
                    bornInfo.rotation   = rotation;
                }
            }
        }

        if (eType == CreateObjType.eMonster)
        {
            NpcInfo npcinfo;
            if (EditerDataClass._Instance.GetNpcInfo().TryGetValue(id, out npcinfo))
            {
                BornInfo bornInfo = obj.GetComponent <BornInfo>();
                if (bornInfo != null)
                {
                    bornInfo.m_eObjType = 0;
                    bornInfo.me_Type    = CreateMode.enPointObj;
                    bornInfo.mi_ObjId   = id;
                    bornInfo.ms_Name    = npcinfo.name;
                    bornInfo.rotation   = rotation;
                }
            }
        }

        if (eType == CreateObjType.eObj)
        {
            ObjInfo objinfo;
            if (EditerDataClass._Instance.GetObjInfo().TryGetValue(id, out objinfo))
            {
                BornInfo bornInfo = obj.GetComponent <BornInfo>();
                if (bornInfo != null)
                {
                    bornInfo.m_eObjType = 2;
                    bornInfo.me_Type    = CreateMode.enPointObj;
                    bornInfo.mi_ObjId   = id;
                    bornInfo.ms_Name    = objinfo.name;
                    bornInfo.rotation   = rotation;
                }
            }
        }


        obj.transform.localScale = new Vector3(0.2f, 0.2f, 0.01f);
        return(obj);
    }
    //生成键G按下
    void OnKeyGDown()
    {
        if (mb_IsHaveObStacle)
        {
            return;
        }
        GameObject    obj   = null;
        CreateObjType eType = CreateObjType.eInvalid;

        if (m_bShowFunNpc)
        {
            eType = CreateObjType.eFunNpc;
        }
        if (m_bShowNpc)
        {
            eType = CreateObjType.eMonster;
        }
        if (m_bShowObj)
        {
            eType = CreateObjType.eObj;
        }
        switch (m_enCreateMode)
        {
        case CreateMode.enObstcale:
            obj = AddPosToObstacle(mp_MousPos.x, mp_MousPos.y, mp_MousPos.z);
            break;

        case CreateMode.enScenePoint:     //场景点(可能是随机刷怪点)
            Vector2 ScenePointPos = GetMapPosWith3DPos(mp_MousPos.x, mp_MousPos.y);
            //obj = AddScenePointToMap(ScenePointPos.x, ScenePointPos.y, -1);
            break;

        case CreateMode.enPathPoint:    //路径点
            //Vector2 pathPointPos = GetMapPosWith3DPos(mp_MousPos.x, mp_MousPos.y);
            //obj = AddPathPointToMap(pathPointPos.x, pathPointPos.y, -1);
            break;

        case CreateMode.enRegionObj:    //范围怪
            Vector2 regionNpcPos = GetMapPosWith3DPos(mp_MousPos.x, mp_MousPos.y);
            obj = AddReginNpc(regionNpcPos.x, regionNpcPos.y, -1, m_nChooseId, eType, 0);
            break;

        case CreateMode.enPointObj:    //定点怪
            Vector2 pointNpcPos = GetMapPosWith3DPos(mp_MousPos.x, mp_MousPos.y);
            obj = AddPointNpc(pointNpcPos.x, pointNpcPos.y, -1, m_nChooseId, eType, 0);
            break;

        case CreateMode.enPatrolPoint:    //npc巡逻点
            Vector2 objPos = GetMapPosWith3DPos(mp_MousPos.x, mp_MousPos.y);
            if (Selection.gameObjects.Length == 1)
            {
                BornInfo info = Selection.gameObjects[0].GetComponent <BornInfo>();
                if (info == null)
                {
                    return;
                }
                obj = AddNpcPatrolPoint(objPos.x, objPos.y, -1, Selection.gameObjects[0]);
            }

            break;

        default:
            break;
        }


        if (obj != null)
        {
            Undo.RegisterCreatedObjectUndo(obj, "InstantiatePrefabWithpos");
        }
    }