public int[] GetReceivers(SparkTargets targets) { if (targets == SparkTargets.Not_Master) { List <int> receiverIds = sparkMatch.peerList.Select(x => x.id).ToList(); receiverIds.Remove(MasterPlayer.id); return(receiverIds.ToArray()); } if (targets == SparkTargets.Master) { return(new int[] { MasterPlayer.id }); } if (targets == SparkTargets.Others) { List <int> receiverIds = sparkMatch.peerList.Select(x => x.id).ToList(); receiverIds.Remove(LocalPlayer.id); return(receiverIds.ToArray()); } return(null); }
/// <summary> /// RPC call. /// </summary> /// <param name="methodName">Method name.</param> /// <param name="targetPlayer">Target player.</param> /// <param name="isBuffered">If set to <c>true</c> is buffered.</param> /// <param name="parameters">Parameters.</param> public void RPC(string methodName, SparkTargets targets, bool isBuffered, params object[] parameters) { RPC(methodName, SparkManager.instance.GetReceivers(targets), isBuffered, parameters); }
/// <summary> /// Local RPC call. /// </summary> /// <param name="methodName">Method name.</param> /// <param name="targetPlayer">Target player.</param> /// <param name="isBuffered">If set to <c>true</c> is buffered.</param> /// <param name="parameters">Parameters.</param> private void LocalRPC(string methodName, SparkTargets targets, bool isBuffered, params object[] parameters) { LocalRPC(methodName, GetReceivers(targets), isBuffered, parameters); }