using Cyber.Entities; using UnityEngine.Networking; namespace Cyber.Networking.Messages { /// /// Includes information about interacting an interactible. Applicable only for some interactibles. /// public class InteractionPkt : MessageBase { /// /// ID of the interactible. /// public int InteractSyncBaseID; /// /// Id of the interactor. /// public int OwnerSyncBaseID; /// /// The interaction type that was made. /// public InteractionType InteractionType; /// /// Creates an InteraktionPkt, which contains the message "someone interacted". /// /// The Sync Base ID of the interacted thing. /// The type of interaction that was made. public InteractionPkt(int syncBaseID, InteractionType interactionType) { InteractSyncBaseID = syncBaseID; InteractionType = interactionType; } /// /// Empty constructor for deserialization. /// public InteractionPkt() {} /// /// Deserializes SyncBaseID for the recipent. /// /// public override void Deserialize(NetworkReader reader) { InteractSyncBaseID = reader.ReadInt32(); OwnerSyncBaseID = reader.ReadInt32(); InteractionType = (InteractionType) reader.ReadByte(); } /// /// Serializes the SyncBaseID for sending. /// /// public override void Serialize(NetworkWriter writer) { writer.Write(InteractSyncBaseID); writer.Write(OwnerSyncBaseID); writer.Write((byte) InteractionType); } } }