/// <summary> /// 请求创建对象 /// </summary> void ReqCreateObject(EventArgs args) { EventObjectArgs objectArgs = args as EventObjectArgs; if (objectArgs != null && objectArgs.t != null) { ProtoCreateObject[] list = objectArgs.t as ProtoCreateObject[]; ProtoSyncObjectList createObjectProto = ObjectPool.protoPool.GetOrCreate <ProtoSyncObjectList>(ProtoPool.ProtoRecycleType.CreateObjects); createObjectProto.objList = list; Send(ProtoIDCfg.CREATE_OBJECTS, createObjectProto, ProtoType.Importance); createObjectProto.Recycle(); } }
//检查创建对象 void CheckCreate() { if (appearTag != null) { for (int i = 0; i < appearTag.Length; i++) { if (appearTag[i] == false) { AppearSetData apData = levelData.appearSets[i]; if (gameTime >= apData.time) { appearTag[i] = true; if (apData.objectCfgs != null && apData.objectCfgs.Length > 0) { Debug.Log("第" + i + "波"); ProtoCreateObject[] list = new ProtoCreateObject[apData.objectCfgs.Length]; for (int z = 0; z < list.Length; z++) { var objData = apData.objectCfgs[z]; list[z] = new ProtoCreateObject(); list[z].objectIndex = objData.objectIndex; int id = GetCreateID(); list[z].hashCode = id; AddObjectCfg(id, objData); list[z].SetPos(GetPosByRadian(transform.position, objData.XAngle, objData.distance, objData.YAngle)); } var t = new EventObjectArgs(); t.t = list; SceneController.instance.SendNetMsg(ProtoIDCfg.CREATE_OBJECTS, t); } } } } } }