Exemple #1
0
        //Constructors:
        public TransmissionMessage(TransmissionMessageType type, TransmissionAudience audience, string targetAddress = "", bool reliable = false, string data = "", string guid = "")
        {
            switch (audience)
            {
            case TransmissionAudience.SinglePeer:
                r = reliable ? 1 : 0;
                t = targetAddress;
                break;

            case TransmissionAudience.KnownPeers:
                r = reliable ? 1 : 0;
                t = "";
                break;

            case TransmissionAudience.NetworkBroadcast:
                r = 0;
                t = "255.255.255.255";
                break;
            }

            //guids are only required for reliable messages:
            if (reliable && string.IsNullOrEmpty(guid))
            {
                g = Guid.NewGuid().ToString();
            }
            else
            {
                g = guid;
            }


            f  = NetworkUtilities.MyAddress;
            ti = Math.Round(Time.realtimeSinceStartup, 3);
            d  = data;
            ty = (short)type;
            a  = Transmission.Instance.appKey;
            p  = Transmission.Instance.privateKey;
        }
 //Constructors:
 public FloatArrayMessage(float[] values, string data = "", TransmissionAudience audience = TransmissionAudience.KnownPeers, string targetAddress = "") : base(TransmissionMessageType.FloatArrayMessage, audience, targetAddress, true, data)
 {
     v = values;
 }
 //Constructors:
 public Vector4Message(Vector4 value, string data = "", TransmissionAudience audience = TransmissionAudience.KnownPeers, string targetAddress = "") : base(TransmissionMessageType.Vector4Message, audience, targetAddress, true, data)
 {
     v = value;
 }
 //Constructors:
 public RPCMessage(string methodToCall, string parameter = "", string data = "", TransmissionAudience audience = TransmissionAudience.KnownPeers, string targetAddress = "") : base(TransmissionMessageType.RPCMessage, audience, targetAddress, true, data)
 {
     m  = methodToCall;
     pa = parameter;
 }
Exemple #5
0
 //Constructors:
 public QuaternionMessage(Quaternion value, string data = "", TransmissionAudience audience = TransmissionAudience.KnownPeers, string targetAddress = "") : base(TransmissionMessageType.QuaternionMessage, audience, targetAddress, true, data)
 {
     v = value;
 }