using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Security; namespace BITKit { public interface IAwake { void OnAwake(); } public interface IStart { void OnStart(); } public interface IStop { void OnStop(); } public interface IAction { void Excute(); } public interface IUpdate { void OnUpdate(float deltaTime); } public interface IEnabled { bool IsEnabled(); void SetEnabled(bool enabled); } public interface ICheckable { string GetDescription(); string GetName(); } public interface IDetected { void OnDetected(T t); void OnMissDetected(T t); } public interface INext { bool Next(); } public interface IPrevious { bool Previous(); } public interface INextble : INext, IPrevious { } public interface IFixedUpdate { void OnFixedUpdate(float deltaTime); } public interface ILateUpdate { void OnLateUpdate(float deltaTime); } public interface IDestroy { void OnDestroyComponent(); } public class BehaviorUpdater { public IAwake[] awakes; public IStart[] starts; public IStop[] stops; public IUpdate[] updates; public IFixedUpdate[] fixedUpdates; public ILateUpdate[] lateUpdates; public IDestroy[] destroys; public void OnAwake() { awakes.ForEach(x => x.OnAwake()); } public void OnStart() { starts.ForEach(x => x.OnStart()); } public void OnStop() { stops.ForEach(x => x.OnStop()); } public void OnUpdate(float deltaTime) { updates.ForEach(x => x.OnUpdate(deltaTime)); } public void OnFixedUpdate(float deltaTime) { fixedUpdates.ForEach(x => x.OnFixedUpdate(deltaTime)); } public void OnLateUpdate(float deltaTime) { lateUpdates.ForEach(x => x.OnLateUpdate(deltaTime)); } public void OnDestroy() { destroys.ForEach(x => x.OnDestroyComponent()); } } }