public static void Init(RelativeTopSpeed rts) { RTS = rts; APIMethods = new Dictionary <string, Delegate>() { ["GetCruiseSpeed"] = new Func <IMyCubeGrid, float>(RTS.GetCruiseSpeed), ["GetMaxSpeed"] = new Func <IMyCubeGrid, float>(RTS.GetMaxSpeed), ["GetBoost"] = new Func <IMyCubeGrid, float[]>(RTS.GetBoost), ["GetAcceleration"] = new Func <IMyCubeGrid, float[]>(RTS.GetAcceleration), ["GetAccelerationByDirection"] = new Func <IMyCubeGrid, float[]>(RTS.GetAccelerationsByDirection), }; MyAPIGateway.Utilities.RegisterMessageHandler(ChannelId, OnMessageRecieved); MyAPIGateway.Utilities.SendModMessage(ChannelId, APIMethods); }
public static void Close() { MyAPIGateway.Utilities.UnregisterMessageHandler(ChannelId, OnMessageRecieved); RTS = null; }