public static TreeMessage PrepareTree(uint id) { if (!ManagersUtil.ExistsTree(id)) { return(null); } TreeInstance tree = ManagersUtil.Tree(id); return(new TreeMessage() { id = id, position = tree.Position.FromUnity(), prefab_name = tree.Info.name }); }
public static BatchObjectMessage PrepareTreesStartingFromIndex(uint id) { var buffer = ManagersUtil.TreeManager.m_trees.m_buffer; var resultArray = new TreeData[500]; int resultArrayIndex = 0; bool endOfStream = true; uint i; for (i = id; i < buffer.Length; i++) { if (ManagersUtil.ExistsTree(i)) { resultArray[resultArrayIndex] = PrepareTree(i); resultArrayIndex++; if (resultArrayIndex == 500) { endOfStream = false; break; } } if (i == uint.MaxValue) { break; } } if (endOfStream) { Array.Resize(ref resultArray, resultArrayIndex); } return(new BatchObjectMessage() { array = resultArray, endOfStream = endOfStream, lastVisitedIndex = i }); }