Ejemplo n.º 1
0
        public static SimulatedVessel Borrow(IShipconstruct v, SimCurves simCurves)
        {
            SimulatedVessel vessel = pool.Borrow();

            vessel.Init(v, simCurves);
            return(vessel);
        }
Ejemplo n.º 2
0
        public static SimulatedPart Borrow(Part p, SimulatedVessel vessel)
        {
            SimulatedPart part = pool.Borrow();

            part.vessel = vessel;
            part.Init(p);
            return(part);
        }
Ejemplo n.º 3
0
 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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 private static void Reset(SimulatedVessel obj)
 {
     obj.partCollection.Release();
     obj.partCollection = null;
 }