2017-05-11 00:52:05 +02:00
|
|
|
|
|
2017-05-12 00:41:57 +02:00
|
|
|
|
using Cyber.Entities;
|
2017-05-11 00:52:05 +02:00
|
|
|
|
using UnityEngine.Networking;
|
|
|
|
|
|
|
|
|
|
namespace Cyber.Networking.Messages {
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Includes information about interacting an interactible. Applicable only for some interactibles.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class InteractionPkt : MessageBase {
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ID of the interactible.
|
|
|
|
|
/// </summary>
|
2017-05-11 04:03:07 +02:00
|
|
|
|
public int InteractSyncBaseID;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Id of the interactor.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int OwnerSyncBaseID;
|
2017-05-11 00:52:05 +02:00
|
|
|
|
|
2017-05-12 00:41:57 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The interaction type that was made.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public InteractionType InteractionType;
|
|
|
|
|
|
2017-05-11 00:52:05 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates an InteraktionPkt, which contains the message "someone interacted".
|
|
|
|
|
/// </summary>
|
2017-05-11 05:13:02 +02:00
|
|
|
|
/// <param name="syncBaseID">The Sync Base ID of the interacted thing.</param>
|
2017-05-12 00:41:57 +02:00
|
|
|
|
/// <param name="interactionType">The type of interaction that was made.</param>
|
|
|
|
|
public InteractionPkt(int syncBaseID, InteractionType interactionType) {
|
2017-05-11 04:03:07 +02:00
|
|
|
|
InteractSyncBaseID = syncBaseID;
|
2017-05-12 00:41:57 +02:00
|
|
|
|
InteractionType = interactionType;
|
2017-05-11 00:52:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Empty constructor for deserialization.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public InteractionPkt() {}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Deserializes SyncBaseID for the recipent.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="reader"></param>
|
|
|
|
|
public override void Deserialize(NetworkReader reader) {
|
2017-05-11 04:03:07 +02:00
|
|
|
|
InteractSyncBaseID = reader.ReadInt32();
|
|
|
|
|
OwnerSyncBaseID = reader.ReadInt32();
|
2017-05-12 00:41:57 +02:00
|
|
|
|
InteractionType = (InteractionType) reader.ReadByte();
|
2017-05-11 00:52:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Serializes the SyncBaseID for sending.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="writer"></param>
|
|
|
|
|
public override void Serialize(NetworkWriter writer) {
|
2017-05-11 04:03:07 +02:00
|
|
|
|
writer.Write(InteractSyncBaseID);
|
|
|
|
|
writer.Write(OwnerSyncBaseID);
|
2017-05-12 00:41:57 +02:00
|
|
|
|
writer.Write((byte) InteractionType);
|
2017-05-11 00:52:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|