using UnityEngine;
using UnityEngine.Networking;
namespace Cyber.Networking.Messages {
///
/// Packet informing the client to move a creature, or the server to request change in movement.
/// More information at
///
public class MoveCreaturePkt : MessageBase {
///
/// Direction of the new movement (or (0, 0, 0) for stopping)
///
public Vector3 Direction;
///
/// SyncBase ID of the Creature to be moved.
///
public int SyncBaseID;
///
/// Creates a MoveCreaturePkt which contains the direction of desired movement (or (0, 0, 0) for stopping)
///
/// Direction of movement
/// SyncBase ID of the Creature.
public MoveCreaturePkt(Vector3 direction, int syncBaseId) {
Direction = direction;
SyncBaseID = syncBaseId;
}
///
/// Parameter-less constructor using when deserializing the message.
///
public MoveCreaturePkt() {
}
///
/// Used to deserialize a message received via networking.
///
///
public override void Deserialize(NetworkReader reader) {
Direction = reader.ReadVector3();
SyncBaseID = reader.ReadInt32();
}
///
/// Used to serialize the message before it is sent.
///
///
public override void Serialize(NetworkWriter writer) {
writer.Write(Direction);
writer.Write(SyncBaseID);
}
}
}