public static SimulatedVessel Borrow(IShipconstruct v, SimCurves simCurves) { SimulatedVessel vessel = pool.Borrow(); vessel.Init(v, simCurves); return(vessel); }
public static SimulatedPart Borrow(Part p, SimulatedVessel vessel) { SimulatedPart part = pool.Borrow(); part.vessel = vessel; part.Init(p); return(part); }
private static void Reset(SimulatedVessel obj) { SimulatedPart.Release(obj.parts); obj.parts.Clear(); SimulatedLiftingSurface.Release(obj.surfaces); obj.surfaces.Clear(); SimulatedControlSurface.Release(obj.ctrls); obj.ctrls.Clear(); SimulatedEngine.Release(obj.engines); obj.engines.Clear(); }
public static RotorPartCollection BorrowWithoutAdding(SimulatedVessel vessel, Part originPart) { RotorPartCollection collection; lock (pool) collection = pool.Borrow(); collection.parentVessel = vessel; collection.Init(originPart); return(collection); }
public static PartCollection Borrow(SimulatedVessel v, Part originPart) { PartCollection collection; // This lock is more expansive than it needs to be. // There is still a race condition within Init that causes // extra drag in the simulation, but this section is not a // performance bottleneck and so further refinement is #TODO. lock (pool) { collection = pool.Borrow(); collection.parentVessel = v; collection.AddPart(originPart); } return(collection); }
private static void Reset(SimulatedVessel obj) { obj.partCollection.Release(); obj.partCollection = null; }