public override void Unregister(AliveTickable tickable) { if (tickable.Get <TTickable>() == null) { return; } tickables.Remove(tickable); }
public override void Register(AliveTickable tickable) { if (tickable.Get <TTickable>() == null) { return; } tickables.Add(tickable); tickables.Sort((a, b) => { var aT = a.Get <TTickable>() as IPriority <TTickable>; var bT = b.Get <TTickable>() as IPriority <TTickable>; Assert.IsNotNull(aT, $"aT {a.GetType().Name}, not IPriority<{typeof(TTickable).Name}>"); Assert.IsNotNull(bT, $"bT {b.GetType().Name}, not IPriority<{typeof(TTickable).Name}>"); return(aT.Priority(aT) - bT.Priority(bT)); }); }