using System;
using LanLib.UpdateManager.Jobs.Internal;
namespace LanLib.UpdateManager.Jobs
{
///
/// Implement this interface and register object with to get job scheduled every frame.
///
public interface ITransformJobUpdatable : IInitialTransformJobDataProvider
where TData : struct, IUpdateTransformJob
{
}
///
/// Alias for .
///
///
/// Deprecated: use instead and implement
/// in job definition to compile jobs with Burst.
///
[Obsolete("Use ITransformJobUpdatable<> and implement IBurstUpdateTransformJob<> in job definition instead.")]
public interface ITransformJobUpdatable : ITransformJobUpdatable
where TData : struct, IUpdateTransformJob
where TJob : struct, IInternalUpdateTransformJob
{
}
public static class ITransformJobUpdatableExtensions
{
///
/// Shortcut for UpdateTransformJobManager<TData>.Instance.Register().
///
///
public static void RegisterInManager(this ITransformJobUpdatable updatable)
where TData : struct, IUpdateTransformJob
{
UpdateTransformJobManager.Instance.Register(updatable);
}
///
/// Shortcut for UpdateTransformJobManager<TData>.Instance.Register(, ).
///
///
public static void RegisterInManager(this ITransformJobUpdatable updatable, bool syncEveryFrame)
where TData : struct, IUpdateTransformJob
{
UpdateTransformJobManager.Instance.Register(updatable, syncEveryFrame);
}
///
/// Shortcut for UpdateTransformJobManager<TData>.Instance.Unregister().
///
///
public static void UnregisterInManager(this ITransformJobUpdatable updatable)
where TData : struct, IUpdateTransformJob
{
UpdateTransformJobManager.Instance.Unregister(updatable);
}
///
/// Shortcut for UpdateTransformJobManager<TData>.Instance.UnregisterSynchronization().
///
///
public static void UnregisterSynchronizationInManager(this ITransformJobUpdatable updatable)
where TData : struct, IUpdateTransformJob
{
UpdateTransformJobManager.Instance.UnregisterSynchronization(updatable);
}
///
/// Shortcut for UpdateTransformJobManager<TData>.Instance.IsRegistered().
///
///
public static bool IsRegisteredInManager(this ITransformJobUpdatable updatable)
where TData : struct, IUpdateTransformJob
{
return UpdateTransformJobManager.Instance.IsRegistered(updatable);
}
///
/// Shortcut for UpdateTransformJobManager<TData>.Instance.GetData().
///
///
public static TData GetJobData(this ITransformJobUpdatable updatable)
where TData : struct, IUpdateTransformJob
{
return UpdateTransformJobManager.Instance.GetData(updatable);
}
///
/// Shortcut for UpdateTransformJobManager<TData>.Instance.SynchronizeJobDataOnce().
///
///
public static void SynchronizeJobDataOnce(this ITransformJobUpdatable updatable)
where TData : struct, IUpdateTransformJob
{
UpdateTransformJobManager.Instance.SynchronizeJobDataOnce(updatable);
}
}
}