public static HackingNodeConnectionList Send(GameObject recipient, GameObject hackingObject, List <int[]> connectionList) { HackingNodeConnectionList msg = new HackingNodeConnectionList { Recipient = recipient.GetComponent <NetworkIdentity>().netId, HackingObject = hackingObject.GetComponent <NetworkIdentity>().netId, JsonData = JsonConvert.SerializeObject(connectionList) }; msg.SendToNearbyPlayers(hackingObject.transform.position); return(msg); }
public override void Process() { LoadMultipleObjects(new uint[] { Player, HackableObject }); int[] connectionToAdd = JsonConvert.DeserializeObject <int[]>(JsonData); var playerScript = NetworkObjects[0].GetComponent <PlayerScript>(); var hackObject = NetworkObjects[1]; HackingProcessBase hackingProcess = hackObject.GetComponent <HackingProcessBase>(); if (hackingProcess.ServerPlayerCanAddConnection(playerScript, connectionToAdd)) { hackingProcess.AddNodeConnection(connectionToAdd); HackingNodeConnectionList.Send(NetworkObjects[0], hackObject, hackingProcess.GetNodeConnectionList()); } }
public override void Process(NetMessage msg) { LoadMultipleObjects(new uint[] { msg.Player, msg.HackableObject }); int[] connectionToRemove = JsonConvert.DeserializeObject <int[]>(msg.JsonData); var playerScript = NetworkObjects[0].GetComponent <PlayerScript>(); var hackObject = NetworkObjects[1]; HackingProcessBase hackingProcess = hackObject.GetComponent <HackingProcessBase>(); if (hackingProcess.ServerPlayerCanRemoveConnection(playerScript, connectionToRemove)) { hackingProcess.ServerPlayerRemoveConnection(playerScript, connectionToRemove); HackingNodeConnectionList.Send(NetworkObjects[0], hackObject, hackingProcess.GetNodeConnectionList()); } }
public override void Process() { LoadMultipleObjects(new uint[] { Player, HackableObject, HackingDevice }); var playerScript = NetworkObjects[0].GetComponent <PlayerScript>(); var hackObject = NetworkObjects[1]; HackingDevice hackDevice = NetworkObjects[2].GetComponent <HackingDevice>(); HackingProcessBase hackingProcess = hackObject.GetComponent <HackingProcessBase>(); if (hackingProcess.ServerPlayerCanAddDevice(playerScript, hackDevice)) { hackingProcess.AddHackingDevice(hackDevice); hackingProcess.ServerStoreHackingDevice(hackDevice); HackingNodeConnectionList.Send(NetworkObjects[0], hackObject, hackingProcess.GetNodeConnectionList()); } }
public override void Process() { LoadMultipleObjects(new uint[] { Player, HackableObject }); int[] connectionToAdd = JsonConvert.DeserializeObject <int[]>(JsonData); var playerScript = NetworkObjects[0].GetComponent <PlayerScript>(); var hackObject = NetworkObjects[1]; HackingProcessBase hackingProcess = hackObject.GetComponent <HackingProcessBase>(); if (hackingProcess.ServerPlayerCanAddConnection(playerScript, connectionToAdd)) { SoundManager.PlayNetworkedAtPos(SingletonSOSounds.Instance.WireMend, playerScript.WorldPos); hackingProcess.AddNodeConnection(connectionToAdd); HackingNodeConnectionList.Send(NetworkObjects[0], hackObject, hackingProcess.GetNodeConnectionList()); } }
void SendDataToClient(GameObject recipient, GameObject hackObject, List <int[]> connectionList) { HackingNodeConnectionList.Send(recipient, hackObject, connectionList); }