public static UpdateHeadsetKeyMessage Send(GameObject headsetItem, GameObject encryptionkey = null) { UpdateHeadsetKeyMessage msg = new UpdateHeadsetKeyMessage { HeadsetItem = headsetItem ? headsetItem.GetComponent <NetworkIdentity>().netId : NetworkInstanceId.Invalid, EncryptionKey = encryptionkey ? encryptionkey.GetComponent <NetworkIdentity>().netId : NetworkInstanceId.Invalid }; msg.Send(); return(msg); }
public bool Interact(InventoryApply interaction) { //remove the headset key if this is used on a headset if (interaction.HandObject == gameObject && interaction.TargetObject.GetComponent <Headset>() != null) { UpdateHeadsetKeyMessage.Send(interaction.TargetObject); return(true); } return(false); }
public override bool Interact(GameObject originator, Vector3 position, string hand) { //Only peform EncryptionKey actions on other things when holding the encryptionkey if (UIManager.Hands.CurrentSlot.Item != gameObject) { return(base.Interact(originator, position, hand)); } GameObject otherHandsItem = UIManager.Hands.OtherSlot.Item; if (otherHandsItem && otherHandsItem.GetComponent <Headset>()) { UpdateHeadsetKeyMessage.Send(otherHandsItem, gameObject); } return(base.Interact(originator, position, hand)); }
public override bool Interact(GameObject originator, Vector3 position, string hand) { //Only peform screwdriver actions on other things when holding the screwdriver if (UIManager.Hands.CurrentSlot.Item != gameObject) { return(base.Interact(originator, position, hand)); } //TODO detect the actual target of the interact, instead of requiring the headset to be in the other hand GameObject otherHandsItem = UIManager.Hands.OtherSlot.Item; if (otherHandsItem && otherHandsItem.GetComponent <Headset>()) { //Remove encryption key UpdateHeadsetKeyMessage.Send(otherHandsItem); } return(base.Interact(originator, position, hand)); }