public void receiveCommand(KM_RadioControl sender, int group, int transmitChannel) { if (this == sender || channel != transmitChannel) { MonoBehaviour.print("I am the sender or channels are not equal:" + channel + ", " + transmitChannel); return; } print("Listener:" + vessel.vesselName + "received command" + group); km_Helper.fireEvent(this.part, (int)group); indicateReceive(true); }
public void receiveThrottle(KM_RadioControl sender, float throttle, int transmitChannel) { if (this == sender || channel != transmitChannel) { MonoBehaviour.print("I am the sender or channels are not equal:" + channel + ", " + transmitChannel); return; } print("Listener:" + vessel.vesselName + "received command" + group); this.vessel.ctrlState.mainThrottle = throttle; indicateReceive(true); }
/* * public void transmitRotationTo(Vector3 target, bool playSound){ * foreach (var listener in Utility.radioListeners) { * if(listener != null && listener.vessel!= null) * listener.receiveRotation (this, Quaternion.LookRotation((target-listener.vessel.findWorldCenterOfMass()).normalized), (int) channel, playSound); } * indicateSend (); * * * }*/ public void receiveRotation(KM_RadioControl sender, Quaternion targetUp, int transmitChannel, bool playSound) { if (this == sender || channel != transmitChannel || this.vessel == FlightGlobals.ActiveVessel) { MonoBehaviour.print("I am the active vessel or the sender or channels are not equal:" + channel + ", " + transmitChannel); return; } this.vessel.ActionGroups.SetGroup(KSPActionGroup.SAS, true); print("Listener:" + vessel.vesselName + "received command" + group); this.vessel.vesselSAS.LockHeading(targetUp, true); this.vessel.vesselSAS.Update(); indicateReceive(playSound); }