/// <summary> /// Registers an object appropriately. ID must be added before calling this method. /// Use this for any non-temporary galaxy object (ships, planets, etc) /// If object has already been registered, it is updated with the new provided version /// </summary> /// <param name="obj"></param> public void RegisterObject(IHasGalaxyID obj) { //Need to add players here, maybe accounts if (obj is ICollidable) { _collisionManager.RegisterCollidableObject((ICollidable)obj); } if (obj is ISimulatable) { _galaxyManager.RegisterSimulatable((ISimulatable)obj); } _galaxyManager.AllObjects.AddOrUpdate(obj.Id, obj, (k, v) => obj); if (obj is IArea) { _galaxyManager.RegisterArea((IArea)obj); } if (obj is IShip) { _shipManager.RegisterShip((IShip)obj); } if (obj is IStructure) { _structureManager.RegisterObject((IStructure)obj); } }
public void DeRegisterObject(IHasGalaxyID obj) { ISimulatable tempSim; IHasGalaxyID tempGal; //Maybe a type check is faster than TryRemove? _collisionManager.TryRemoveCollidableKey(obj.Id); _galaxyManager.DeRegisterArea(obj.Id); _galaxyManager.AllSimulatableObjects.TryRemove(obj.Id, out tempSim); _galaxyManager.AllObjects.TryRemove(obj.Id, out tempGal); _shipManager.DeregisterShip(obj.Id); _galaxyIDManager.PushFreeID(obj.Id); }
public void DeRegisterObject(IHasGalaxyID obj) { }