Exemplo n.º 1
0
    public static Obj TryAddObj(Net.p_obj ObjInfo)
    {
        var pos = Common.GetLocalPos(ObjInfo.Pos);
        Obj Obj;

        if (ObjMgr.Objs.ContainsKey(ObjInfo.Id))
        {
            Obj = ObjMgr.Objs[ObjInfo.Id];
        }
        else
        {
            Obj = ObjMgr.NewObj(pos, ObjInfo.Type, ObjInfo.Id);
            Obj.Init();
        }

        if (ObjInfo.Pos.X != 0 && ObjInfo.Pos.Y != 0)
        {
            Obj.GPose = pos;
        }
        if (!ObjInfo.Name.Equals(""))
        {
            Obj.SetName(ObjInfo.Name);
        }

        if (ObjInfo.Status == (int)(ObjStatus.NONE) && Obj.HasStatus(ObjStatus.MOVE))
        {
            Obj.DoStopMove();
        }
        else if (ObjInfo.Status == (int)ObjStatus.MOVE)
        {
            Obj.SetSpeed(ObjInfo.Speed);
            Obj.DoMove((ObjDirection)ObjInfo.Direction);
        }
        return(Obj);
    }
Exemplo n.º 2
0
 void initTerrain()
 {
     m_terrains = new Obj[Config.TerrainArrayX * Config.TerrainArrayY];
     for (int x = -Config.TerrainArrayX / 2; x < Config.TerrainArrayX / 2; x++)
     {
         for (int z = -Config.TerrainArrayY / 2; z < Config.TerrainArrayY / 2; z++)
         {
             int i = x + Config.TerrainArrayX / 2, j = z + Config.TerrainArrayY / 2;
             Obj terrain = ObjMgr.NewObj(new Vector3(x * Config.TerrainMeshX + MapCenterPos.x, 0, z * Config.TerrainMeshY + MapCenterPos.z), T_Obj.T_TERRAIN.GenObjType(), i * Config.TerrainArrayY + j + 1000000);
             terrain.Init();
             m_terrains[i * Config.TerrainArrayY + j] = terrain;
         }
     }
 }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        for (int x = 0; x < 10; x++)
        {
            //Instantiate(Map.Instance.ObjPrefab,new Vector3(x,1,1), Quaternion.identity);
            testobj = ObjMgr.NewObj(new Vector3(x, 0, 0), T_Obj.T_NPC.T_TestNPC.GenObjType(), 1);
            testobj.Init();
        }
        //testobj = ObjMgr.NewObj(new Vector3(122, 117, 115), T_Obj.NPC().TestNPC().GenObjType(), 1);
        // testobj.Init();
        //testobj.Light();

        // var testobj1 = ObjMgr.NewObj(new Vector3(1, 1, 2), T_Obj.NPC().TestNPC().GenObjType(), 2);
        //testobj1.Init();
        // testobj1.Light();
    }