public void RpcTriggerInteractable(int hackerId, string rawCommand) { CommandPacket commandPacket; Hacker hacker = _playerHub.GetPlayer(hackerId).GetComponent <Hacker>(); Message callbackMessage; if (HackerFunctions.TryCreatePacket(rawCommand, out commandPacket)) { List <Device> devices = FindObjectsOfType <Device>().ToList(); callbackMessage = new Message(false, new ID(), MessageType.ERROR, "COULD NOT FIND: \"" + commandPacket.InteractableFullId + "\""); foreach (Device device in devices) { if (device.Id.FullId == commandPacket.InteractableFullId) { callbackMessage = device.Hack(commandPacket); } } } else { callbackMessage = new Message(false, new ID(), MessageType.ERROR, "UNKNOWN COMMAND"); Debug.LogWarning("Could not create packet from: " + rawCommand); } hacker.CallbackMessage(callbackMessage); }
public void SendMessageToHacker(Message message) { Hacker hacker = _playerHub.GetHacker(); if (hacker != null) { hacker.CallbackMessage(message); } }