public static object CreateTree(object msg) { var data = (CreateTreeMessage)msg; TreeInfo info = PrefabCollection <TreeInfo> .FindLoaded(data.prefab_name); Util.Assert(info, "Prefab '" + data.prefab_name + "' not found"); uint id = ManagersUtil.CreateTree(data.Position.ToUnityTerrain(), info, true); return(ManagersLogic.PrepareTree(id)); }
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 BuildingMessage PrepareBuilding(ushort id) { if (!ManagersUtil.ExistsBuilding(id)) { return(null); } Building building = ManagersUtil.BuildingS(id); return(new BuildingMessage() { id = id, position = building.m_position.FromUnity(), prefab_name = building.Info.name, angle = building.m_angle }); }
public static PropMessage PrepareProp(ushort id) { if (!ManagersUtil.ExistsProp(id)) { return(null); } PropInstance prop = ManagersUtil.Prop(id); return(new PropMessage() { id = id, position = prop.Position.FromUnity(), prefab_name = prop.Info.name, angle = prop.Angle }); }
public static BatchObjectMessage PreparePropsStartingFromIndex(ushort id) { var buffer = ManagersUtil.PropManager.m_props.m_buffer; var resultArray = new PropData[500]; int resultArrayIndex = 0; bool endOfStream = true; ushort i; for (i = id; i < buffer.Length; i++) { if (ManagersUtil.ExistsProp(i)) { resultArray[resultArrayIndex] = PrepareProp(i); resultArrayIndex++; if (resultArrayIndex == 500) { endOfStream = false; break; } } if (i == ushort.MaxValue) { break; } } if (endOfStream) { Array.Resize(ref resultArray, resultArrayIndex); } return(new BatchObjectMessage() { array = resultArray, endOfStream = endOfStream, lastVisitedIndex = i }); }