Reorder properties with headers (#1437)

This commit is contained in:
MrGadget 2020-01-17 06:09:08 -05:00 committed by vis2k
parent 11a6fa0d82
commit e4c498312e
2 changed files with 16 additions and 13 deletions

View File

@ -22,16 +22,6 @@ namespace Mirror
{ {
public abstract class NetworkTransformBase : NetworkBehaviour public abstract class NetworkTransformBase : NetworkBehaviour
{ {
// rotation compression. not public so that other scripts can't modify
// it at runtime. alternatively we could send 1 extra byte for the mode
// each time so clients know how to decompress, but the whole point was
// to save bandwidth in the first place.
// -> can still be modified in the Inspector while the game is running,
// but would cause errors immediately and be pretty obvious.
[Tooltip("Compresses 16 Byte Quaternion into None=12, Much=3, Lots=2 Byte")]
[SerializeField] Compression compressRotation = Compression.Much;
public enum Compression { None, Much, Lots, NoRotation }; // easily understandable and funny
[Tooltip("Set to true if moves come from owner client, set to false if moves always come from server")] [Tooltip("Set to true if moves come from owner client, set to false if moves always come from server")]
public bool clientAuthority; public bool clientAuthority;
@ -49,6 +39,20 @@ public enum Compression { None, Much, Lots, NoRotation }; // easily understandab
[Tooltip("Changes to the transform must exceed these values to be transmitted on the network.")] [Tooltip("Changes to the transform must exceed these values to be transmitted on the network.")]
public float localScaleSensitivity = .01f; public float localScaleSensitivity = .01f;
// rotation compression. not public so that other scripts can't modify
// it at runtime. alternatively we could send 1 extra byte for the mode
// each time so clients know how to decompress, but the whole point was
// to save bandwidth in the first place.
// -> can still be modified in the Inspector while the game is running,
// but would cause errors immediately and be pretty obvious.
[Header("Compression")]
[Tooltip("Compresses 16 Byte Quaternion into None=12, Much=3, Lots=2 Byte")]
[SerializeField] Compression compressRotation = Compression.Much;
public enum Compression { None, Much, Lots, NoRotation }; // easily understandable and funny
// target transform to sync. can be on a child.
protected abstract Transform targetComponent { get; }
// server // server
Vector3 lastPosition; Vector3 lastPosition;
Quaternion lastRotation; Quaternion lastRotation;
@ -71,9 +75,6 @@ public class DataPoint
// local authority send time // local authority send time
float lastClientSendTime; float lastClientSendTime;
// target transform to sync. can be on a child.
protected abstract Transform targetComponent { get; }
// serialization is needed by OnSerialize and by manual sending from authority // serialization is needed by OnSerialize and by manual sending from authority
static void SerializeIntoWriter(NetworkWriter writer, Vector3 position, Quaternion rotation, Compression compressRotation, Vector3 scale) static void SerializeIntoWriter(NetworkWriter writer, Vector3 position, Quaternion rotation, Compression compressRotation, Vector3 scale)
{ {

View File

@ -10,7 +10,9 @@ namespace Mirror
[HelpURL("https://mirror-networking.com/docs/Components/NetworkTransformChild.html")] [HelpURL("https://mirror-networking.com/docs/Components/NetworkTransformChild.html")]
public class NetworkTransformChild : NetworkTransformBase public class NetworkTransformChild : NetworkTransformBase
{ {
[Header("Target")]
public Transform target; public Transform target;
protected override Transform targetComponent => target; protected override Transform targetComponent => target;
} }
} }