当前位置: 首页>>代码示例>>C#>>正文


C# Vessel类代码示例

本文整理汇总了C#中Vessel的典型用法代码示例。如果您正苦于以下问题:C# Vessel类的具体用法?C# Vessel怎么用?C# Vessel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Vessel类属于命名空间,在下文中一共展示了Vessel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: findVesselFwdAxis

        /// <summary>
        /// Find the vessel orientation at the CoM by interpolating from surrounding part transforms
        /// This orientation should be significantly more resistant to vessel flex/wobble than the vessel transform (root part) as a free body rotates about it's CoM
        /// 
        /// Has an issue with the origin shifter causing random bounces
        /// </summary>
        public void findVesselFwdAxis(Vessel v)
        {
            Part closestPart = v.rootPart;
            float offset = (closestPart.transform.position - v.CurrentCoM).sqrMagnitude; // only comparing magnitude, sign and actual value don't matter

            foreach (Part p in v.Parts)
            {
                float partOffset = (p.partTransform.position - v.CurrentCoM).sqrMagnitude;
                if (partOffset < offset)
                {
                    closestPart = p;
                    offset = partOffset;
                }
            }
            ///
            /// now require two things, accounting for any rotation in part placement, and interpolating with surrounding parts (parent/children/symmetry counterparts) to "shift" the location to the CoM
            /// accounting for rotation is the most important, the nearby position will work for now.
            /// Vector3 location = closestPart.partTransform.position - v.CurrentCoM;
            ///
            vesselFacingAxis = closestPart.transform.localRotation * closestPart.orgRot.Inverse() * Vector3.up;
            if (closestPart.symmetryCounterparts != null)
            {
                for (int i = 0; i < closestPart.symmetryCounterparts.Count; i++)
                {
                    vesselFacingAxis += closestPart.symmetryCounterparts[i].transform.localRotation * closestPart.symmetryCounterparts[i].orgRot.Inverse() * Vector3.up;
                }
                vesselFacingAxis /= (closestPart.symmetryCounterparts.Count + 1);
            }
        }
开发者ID:Kramax,项目名称:KramaxAutoPilot,代码行数:35,代码来源:VesselData.cs

示例2: values

        protected override List<Value> values(Vessel vessel, GameEvent events)
        {
            List<Value> v = new List<Value> ();

            double a = 0;

            if (vessel != null) {
                foreach (Part p in vessel.parts) {
                    if (p.Resources [name] != null) {
                        a += p.Resources [name].amount;
                    }
                }
            }

            if (maxAmount != 0) {
                if(vessel == null) {
                    v.Add(new Value("max. resource " + name, maxAmount));
                } else {
                    v.Add(new Value("max. resource " + name, maxAmount, a, a <= maxAmount));
                }
            }

            if (minAmount != 0) {
                if(vessel == null) {
                    v.Add(new Value("min. resource " + name, minAmount));
                } else {
                    v.Add(new Value("min. resource " + name, minAmount, a, a >= minAmount));
                }
            }

            return v;
        }
开发者ID:pweingardt,项目名称:KSPMissionController,代码行数:32,代码来源:ResourceGoal.cs

示例3: values

        protected override List<Value> values(Vessel vessel, GameEvent events)
        {
            List<Value> values = new List<Value> ();

            int count = 0;
            if (vessel != null) {
                foreach (Part p in vessel.Parts) {
                    if (p.partInfo.name.Equals (partName)) {
                        ++count;
                    }
                }
            }
            if(maxPartCount == -1) {
                if (vessel == null) {
                    values.Add (new Value ("Part", partCount + "x " + partName));
                } else {
                    values.Add (new Value ("Part", partCount + "x " + partName, "" + count, count >= partCount));
                }
            } else {
                if (vessel == null) {
                    values.Add (new Value ("max part", maxPartCount + "x " + partName));
                } else {
                    values.Add (new Value ("max part", maxPartCount + "x " + partName, "" + count, count <= maxPartCount));
                }
            }

            return values;
        }
开发者ID:pweingardt,项目名称:KSPMissionController,代码行数:28,代码来源:PartGoal.cs

示例4: endPipe

	//called when un-clicking on a vessel
	public void endPipe(Vessel end)
	{
		if(_currentlyConnecting != null)
			_currentlyConnecting.setOutputVessel(end);

		_currentlyConnecting = null;
	}
开发者ID:lfrankel,项目名称:GGJ2016,代码行数:8,代码来源:PipeManager.cs

示例5: FlyingCamera

 public FlyingCamera(Part thatPart, RenderTexture screen, float aspect)
 {
     ourVessel = thatPart.vessel;
     ourPart = thatPart;
     screenTexture = screen;
     cameraAspect = aspect;
 }
开发者ID:Tahvohck,项目名称:RasterPropMonitor,代码行数:7,代码来源:FlyingCamera.cs

示例6: OnVesselWasModified

        private void OnVesselWasModified(Vessel data)
        {
            if (!ReferenceEquals(data, FlightGlobals.ActiveVessel))
            {
                DebugHelper.Debug("OnVesselWasModified called on non-active vessel, skipping");
                return;
            }
            DebugHelper.Debug("OnVesselWasModified, groups count {0}", Groups.Count);
            //_gui.ClearGroups();
            foreach (var engineGroup in Groups.Values)
            {
                DebugHelper.Debug("Cleaning group {0}: {1} engine(s)", engineGroup.GroupId, engineGroup.EngineRefList.Count);
                engineGroup.EngineRefList.Clear();
            }
            //Groups.Clear();
            RecurseParts(data.rootPart,
                x =>
                {
                    //DebugHelper.Debug("Part {0}", x.name);
                    //x.FindModuleImplementing<>()
                    if (!x.Modules.Contains("EngineGroupModule"))
                    {
                        //DebugHelper.Debug("!x.Modules.Contains('EngineGroupModule')");
                        return;
                    }
                    var moduleRef = x.Modules["EngineGroupModule"] as EngineGroupModule;
                    if (moduleRef == null)
                    {
                        //DebugHelper.Debug("moduleRef == null");
                        return;
                    }
                    var groupId = moduleRef.EngineGroupId;
                    if (string.IsNullOrEmpty(groupId))
                        return;
                    if (!Groups.ContainsKey(groupId))
                    {
                        DebugHelper.Debug("Creating a group {0}", groupId);
                        Groups.Add(groupId, new EngineGroup(groupId));
                        _gui.AddGroup(Groups[groupId]);
                    }
                    foreach (var wrapper in moduleRef.Wrappers)
                    {
                        Groups[groupId].EngineRefList.Add(wrapper);
                    }
                });

            foreach (var groupId in Groups.Keys.ToList())
            {
                if (Groups[groupId].EngineRefList.Count == 0)
                {
                    DebugHelper.Debug("Removing group {0} (no engines)", groupId);
                    _gui.RemoveGroup(Groups[groupId]);
                    Groups.Remove(groupId);
                }
            }
            if (Groups.Count == 0)
            {
                _gui.DisplayNoGroupsMessage();
            }
        }
开发者ID:Cooboo117,项目名称:RealismOverhaul,代码行数:60,代码来源:EngineFlightControl.cs

示例7: OnVesselPack

 private void OnVesselPack(Vessel vessel)
 {
     if (vessel.situation == Vessel.Situations.FLYING)
     {
         lastPackTime[vessel.id] = UnityEngine.Time.realtimeSinceStartup;
     }
 }
开发者ID:Opice,项目名称:DarkMultiPlayer,代码行数:7,代码来源:HackyInAtmoLoader.cs

示例8: ForgetVessel

 public void ForgetVessel(Vessel hackyVessel)
 {
     if (loadingFlyingVessels.ContainsKey(hackyVessel.id))
     {
         loadingFlyingVessels.Remove(hackyVessel.id);
     }
 }
开发者ID:awdAvenger,项目名称:DarkMultiPlayer,代码行数:7,代码来源:HackyInAtmoLoader.cs

示例9: ActiveControlSysIsOnVessel

        public static bool ActiveControlSysIsOnVessel(Vessel v)
        {
            if (FARControlSys.ActiveControlSys != null)
                return FARControlSys.ActiveControlSys.vessel == v;

            return false;
        }
开发者ID:kevin-ye,项目名称:Ferram-Aerospace-Research,代码行数:7,代码来源:FARAPI.cs

示例10: RemoveAllManeuverNodes

 public static void RemoveAllManeuverNodes(Vessel vessel)
 {
     while (vessel.patchedConicSolver.maneuverNodes.Count > 0)
     {
         vessel.patchedConicSolver.RemoveManeuverNode(vessel.patchedConicSolver.maneuverNodes.Last());
     }
 }
开发者ID:RealGrep,项目名称:Protractor2,代码行数:7,代码来源:protractor2.cs

示例11: isDone

        public override bool isDone(Vessel vessel, GameEvent events)
        {
            if (vessel == null)
            {
                return false;
            }

            if (doneOnce)
            {
                return true;
            }

            List<Value> values = getValues(vessel, events);
            foreach (Value v in values)
            {
                if (!v.done)
                {
                    return false;
                }
            }

            // We remember that we have previously completed this goal.
            doneOnce = true;

            return true;
        }
开发者ID:jwvanderbeck,项目名称:KSPMissionController,代码行数:26,代码来源:LaunchGoal.cs

示例12: GetThrustTorque

        public static double GetThrustTorque(Part p, Vessel vessel)
        {
            if (p.State == PartStates.ACTIVE)
            {
                var gimbal = p.Modules.OfType<ModuleGimbal>().FirstOrDefault();

                if (gimbal != null && !gimbal.gimbalLock)
                {
                    var engine = p.Modules.OfType<ModuleEngines>().FirstOrDefault();
                    var fxengine = p.Modules.OfType<ModuleEnginesFX>().FirstOrDefault();

                    var magnitude = (p.Rigidbody.worldCenterOfMass - vessel.CoM).magnitude;
                    var gimbalRange = Math.Sin(Math.Abs(gimbal.gimbalRange));

                    var engineActive = engine != null && engine.isOperational;
                    var enginefxActive = fxengine != null && fxengine.isOperational;

                    if (engineActive)
                    {
                        return gimbalRange * engine.finalThrust * magnitude;
                    }
                    if (enginefxActive)
                    {
                        return gimbalRange * fxengine.finalThrust * magnitude;
                    }
                }
            }
            return 0;
        }
开发者ID:jwvanderbeck,项目名称:KOS_old,代码行数:29,代码来源:SteeringHelper.cs

示例13: GetModel

        public static VesselAerodynamicModel GetModel(Vessel ship, CelestialBody body)
        {
            foreach (var loadedAssembly in AssemblyLoader.loadedAssemblies)
            {
                try
                {
                    switch (loadedAssembly.name)
                    {
                        case "FerramAerospaceResearch":
                            var FARAPIType = loadedAssembly.assembly.GetType("FerramAerospaceResearch.FARAPI");

                                var FARAPI_CalculateVesselAeroForces = FARAPIType.GetMethodEx("CalculateVesselAeroForces", BindingFlags.Public | BindingFlags.Static, new Type[] { typeof(Vessel), typeof(Vector3).MakeByRefType(), typeof(Vector3).MakeByRefType(), typeof(Vector3), typeof(double) });

                            return new FARModel(ship, body, FARAPI_CalculateVesselAeroForces);

                        //case "MyModAssembly":
                        // implement here your atmo mod detection
                        // return new MyModModel(ship, body, any other parameter);
                    }
                }
                catch (Exception e)
                {
                    Debug.Log("Trajectories: failed to interface with assembly " + loadedAssembly.name);
                    Debug.Log("Using stock model instead");
                    Debug.Log(e.ToString());
                }
            }

            // Using stock model if no other aerodynamic is detected or if any error occured
            return new StockModel(ship, body);
        }
开发者ID:CalebJ2,项目名称:KSPTrajectories,代码行数:31,代码来源:AeroDynamicModelFactory.cs

示例14: VesselDto

 public VesselDto(Vessel vessel)
 {
     _VesselId = vessel.ID;
     _OperatorId = vessel.OperatorId;
     _VesselCode = vessel.VesselCode;
     _VesselName = vessel.VesselName;
 }
开发者ID:senolakkas,项目名称:ferrybooking,代码行数:7,代码来源:VesselDto.cs

示例15: GetVesselCrew

        /// <summary>
        /// Gets the vessel crew and works for EVAs as well
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        protected static IEnumerable<ProtoCrewMember> GetVesselCrew(Vessel v)
        {
            if (v == null)
            {
                yield break;
            }

            // EVA vessel
            if (v.vesselType == VesselType.EVA)
            {
                if (v.parts == null)
                {
                    yield break;
                }

                foreach (Part p in v.parts)
                {
                    foreach (ProtoCrewMember pcm in p.protoModuleCrew)
                    {
                        yield return pcm;
                    }
                }
            }
            else
            {
                // Vessel with crew
                foreach (ProtoCrewMember pcm in v.GetVesselCrew())
                {
                    yield return pcm;
                }
            }
        }
开发者ID:Amorymeltzer,项目名称:ContractConfigurator,代码行数:37,代码来源:HasCrew.cs


注:本文中的Vessel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。