void Awake() { // Connect(); NetManager2.Connect(); //请求其他玩家列表 float x = UnityEngine.Random.Range(0, 30); float y = 0.5f; float z = UnityEngine.Random.Range(0, 30); Vector3 pos = new Vector3(x, y, z); Vector3 rot = new Vector3(0, 0, 0); AddPlayer(NetManager2.id, pos, rot); SendTrans(); }
void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 LuaManager.DoFile("Logic/Network"); //加载网络 LuaManager.DoFile("Logic/Network2"); //加载网络 NetManager.OnInit(); //初始化网络 NetManager2.OnInit(); //初始化网络 Util.CallMethod("Game", "OnInitOK"); //初始化完成 initialize = true; // //类对象池测试 // var classObjPool = ObjPoolManager.CreatePool<TestObjectClass>(OnPoolGetElement, OnPoolPushElement); // //方法1 // //objPool.Release(new TestObjectClass("abcd", 100, 200f)); // //var testObj1 = objPool.Get(); // //方法2 // ObjPoolManager.Release<TestObjectClass>(new TestObjectClass("abcd", 100, 200f)); // var testObj1 = ObjPoolManager.Get<TestObjectClass>(); // Debugger.Log("TestObjectClass--->>>" + testObj1.ToString()); // //游戏对象池测试 // var prefab = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject; // var gameObjPool = ObjPoolManager.CreatePool("TestGameObject", 5, 10, prefab); // var gameObj = Instantiate(prefab) as GameObject; // gameObj.name = "TestGameObject_01"; // gameObj.transform.localScale = Vector3.one; // gameObj.transform.localPosition = Vector3.zero; // ObjPoolManager.Release("TestGameObject", gameObj); // var backObj = ObjPoolManager.Get("TestGameObject"); // backObj.transform.SetParent(null); // Debug.Log("TestGameObject--->>>" + backObj); }