using FishNet.Utility.Constant; using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo(UtilityConstants.CODEGEN_ASSEMBLY_NAME)] namespace FishNet.Object { public enum ReplicateState : byte { /// /// The default value of this state. /// This value should never occur when a replicate runs. /// Invalid = 0, /// /// Data is user made, such if it were created within OnTick. /// This occurs when a replicate is called from user code. /// UserCreated = 1, /// /// No data was made from the user; default data is used with an estimated tick. /// This occurs on non-owned objects or server when a replicate is called from user code, and there are no datas enqeued. /// Predicted = 2, /// /// Data is user made, such if it were created within OnTick. /// This occurs when a replicate is replaying past datas, triggered by a reconcile. /// ReplayedUserCreated = 3, /// /// No data was made from the user; default data is used with an estimated tick. /// This occurs when a replicate would be replaying past datas, triggered by a reconcile, but there is no user created data for the tick. /// ReplayedPredicted = 4, } public static class ReplicateStateExtensions { /// /// Returns if value is valid. /// public static bool IsValid(this ReplicateState value) => (value != ReplicateState.Invalid); /// /// Returns if value is replayed. /// public static bool IsReplayed(this ReplicateState value) => (value == ReplicateState.ReplayedPredicted || value == ReplicateState.ReplayedUserCreated); /// /// Returns if value is user created. /// public static bool IsUserCreated(this ReplicateState value) => (value == ReplicateState.UserCreated || value == ReplicateState.ReplayedUserCreated); /// /// Returns if value is predicted. /// public static bool IsPredicted(this ReplicateState value) => !value.IsUserCreated(); } }