AmazingAlek f434ed027b
sector overhaul (#176)
* wrapper for sector
* using world registry for sectors
* using order id as unique sector key
* sector manager
* not checking closest sector every frame
2020-08-16 17:15:36 +02:00

27 lines
638 B
C#

using System.Collections.Generic;
using System.Linq;
namespace QSB.WorldSync
{
public static class WorldRegistry
{
private static readonly List<WorldObject> _worldObjects = new List<WorldObject>();
public static void AddObject(WorldObject worldObject)
{
_worldObjects.Add(worldObject);
}
public static List<T> GetObjects<T>()
{
return _worldObjects.OfType<T>().ToList();
}
public static T GetObject<T>(int id) where T : WorldObject
{
return GetObjects<T>().FirstOrDefault(x => x.ObjectId == id);
}
}
}