public int CreateMarker(int markerType, Vector3 pos, Vector3 dir, Vector3 rot, Vector3 scale, int alpha, int r, int g, int b) { int localEntityHash = ++EntityCounter; var obj = new MarkerProperties() { MarkerType = markerType, Position = pos, Direction = dir, Rotation = rot, Scale = scale, Alpha = (byte)alpha, Red = r, Green = g, Blue = b, EntityType = (byte)EntityType.Marker, }; ServerEntities.Add(localEntityHash, obj); var packet = new CreateEntity(); packet.EntityType = (byte)EntityType.Marker; packet.Properties = obj; packet.NetHandle = localEntityHash; Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true); return(localEntityHash); }
/* * Creates a MarkerProperties instance if the callback is a marker */ public MarkerProperties createMarker() { if (type != EVENT_CALLBACK_TYPE.TIMELINE_MARKER) { UnityEngine.Debug.LogError("Cannot create a marker object. Callback type is not a marker (" + type + ")"); return(null); } // Loads the marker timeline properties from FMOD TIMELINE_MARKER_PROPERTIES marker = (TIMELINE_MARKER_PROPERTIES)Marshal.PtrToStructure(parameters, typeof(FMOD.Studio.TIMELINE_MARKER_PROPERTIES)); IntPtr namePtr = marker.name; int nameLen = 0; while (Marshal.ReadByte(namePtr, nameLen) != 0) { ++nameLen; } byte[] buffer = new byte[nameLen]; Marshal.Copy(namePtr, buffer, 0, buffer.Length); // Create a custom MarkerProperties object and store the marker name and position in them MarkerProperties markerProps = new MarkerProperties(); markerProps.name = Encoding.UTF8.GetString(buffer, 0, nameLen); markerProps.position = marker.position; return(markerProps); }
public int CreateMarker(int markerType, Vector3 pos, Vector3 dir, Vector3 rot, Vector3 scale, int alpha, int r, int g, int b, int dimension) { int localEntityHash; var obj = new MarkerProperties() { MarkerType = markerType, Position = pos, Direction = dir, Rotation = rot, Scale = scale, Alpha = (byte)alpha, Red = r, Green = g, Blue = b, Dimension = dimension, EntityType = (byte)EntityType.Marker, }; lock (ServerEntities) { localEntityHash = GetId(); ServerEntities.Add(localEntityHash, obj); } var packet = new CreateEntity { EntityType = (byte)EntityType.Marker, Properties = obj, NetHandle = localEntityHash }; Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend); return(localEntityHash); }