Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pos"></param>
        /// <param name="baseObjType">基础类型如1001001【Obj=>NPC=>TestNPC】</param>
        /// <param name="curObjType">去除了上一层类型的当前类型,例testObj类型值为1001001【Obj=>NPC=>TestNPC】,则CurObjType为1001【NPC=>TestNPC】</param>
        /// <param name="id"></param>
        /// <param name="pos"></param>
        /// <returns></returns>
        public static NPC NewObj(Vector3 pos, int baseObjType, int curObjType, int id)
        {
            int NextobjType;
            int CurobjType = T_Obj.GetCurObjType(baseObjType, out NextobjType);

            switch (CurobjType)
            {
            case (int)NPCType.TESTNPC:
                return(new TestNPC(pos, baseObjType, id));

            case (int)NPCType.PlAYER:
                return(new Player(pos, baseObjType, id));

            default:
                return(new NPC(pos, baseObjType, id));   // todo
            }
        }
Exemple #2
0
        public static Obj NewObj(Vector3 pos, int objType, int id)
        {
            int NextobjType;
            int CurObjType = T_Obj.GetCurObjType(objType, out NextobjType);
            Obj newObj     = GetOne(objType);

            if (newObj == null)
            {
                switch (CurObjType)
                {
                case (int)ObjType.NPC:
                    newObj = NPCMrg.NewObj(pos, objType, NextobjType, id);
                    break;

                case (int)ObjType.BUILDING:
                    newObj = NPCMrg.NewObj(pos, objType, NextobjType, id);     // todo
                    break;

                case (int)ObjType.TERRAIN:
                    newObj = new Obj(pos, objType, id);     // todo
                    break;

                default:
                    newObj = NPCMrg.NewObj(pos, objType, NextobjType, id);    // todo
                    break;
                }
            }
            else
            {
                newObj.GPose   = pos;
                newObj.ObjType = objType;
                newObj.SetID(id);
            }
            Objs[newObj.ID] = newObj;
            return(newObj);
        }
Exemple #3
0
 /// <summary>
 /// 获取 地形 的类型值
 /// </summary>
 /// <returns></returns>
 public static int GenObjType()
 {
     return(T_Obj.GenObjType() * LevelNum + (int)(ObjType.TERRAIN));;
 }
Exemple #4
0
 public static int GenObjType()
 {
     return(T_Obj.GenObjType() * LevelNum + (int)(ObjType.NPC));
 }