You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace LanLib.UpdateManager
|
|
{
|
|
/// <summary>
|
|
/// <see cref="MonoBehaviour"/> abstract class with automatic registration in <see cref="UpdateManager"/>.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Instances will register themselves for updates in the <c>OnEnable</c> message and unregister in the <c>OnDisable</c> message.
|
|
/// </remarks>
|
|
/// <seealso cref="UpdateManager"/>
|
|
[Obsolete("Prefer inheriting AManagedBehaviour and implementing the IUpdatable/ILateUpdatable/IFixedUpdatable interfaces directly.")]
|
|
public abstract class AUpdateManagerBehaviour : MonoBehaviour, IUpdatable
|
|
{
|
|
protected virtual void OnEnable()
|
|
{
|
|
this.RegisterInManager();
|
|
}
|
|
|
|
protected virtual void OnDisable()
|
|
{
|
|
this.UnregisterInManager();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Implement this for receiving managed updates from <see cref="UpdateManager"/>.
|
|
/// </summary>
|
|
/// <seealso cref="UpdateManager"/>
|
|
public abstract void ManagedUpdate();
|
|
}
|
|
} |