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
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates an InteraktionPkt, which contains the message "someone interacted".
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="SyncBaseID"></param>
|
|
|
|
|
public InteractionPkt(int syncBaseID) {
|
2017-05-11 04:03:07 +02:00
|
|
|
|
InteractSyncBaseID = syncBaseID;
|
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-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-11 00:52:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|