• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Vessel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Start

		protected override void Start()
		{
			//Initialize the map object
			Visible = SCANcontroller.controller.bigMapVisible;
			if (v == null)
				v = FlightGlobals.ActiveVessel;
			if (b == null)
				b = v.mainBody;
			if (bigmap == null)
			{
				bigmap = new SCANmap(b, true);
				bigmap.setProjection((MapProjection)SCANcontroller.controller.projection);
				bigmap.setWidth(SCANcontroller.controller.map_width);
			}
			WindowRect.x = SCANcontroller.controller.map_x;
			WindowRect.y = SCANcontroller.controller.map_y;
			currentColor = SCANcontroller.controller.colours == 0;
			lastColor = currentColor;
			lastResource = SCANcontroller.controller.map_ResourceOverlay;
			WindowCaption = string.Format("Map of {0}", b.theName);
			data = SCANUtil.getData(b);
			if (data == null)
			{
				data = new SCANdata(b);
				SCANcontroller.controller.addToBodyData(b, data);
			}
			bigmap.setBody(b);
			if (SCANconfigLoader.GlobalResource)
			{
				loadedResources = SCANcontroller.setLoadedResourceList();
			}
			TooltipsEnabled = SCANcontroller.controller.toolTips;
		}
开发者ID:DBT85,项目名称:SCANsat,代码行数:33,代码来源:SCANbigMap.cs


示例17: RunCalculations

    public void RunCalculations(
        Vessel vessel,
        Quaternion gymbal)
    {
        // Calculations thanks to Mechjeb
        Vector3d CoM = vessel.findWorldCenterOfMass();
        Vector3d up = (CoM - vessel.mainBody.position).normalized;
        Vector3d velocityVesselOrbit = vessel.orbit.GetVel();
        Vector3d velocityVesselOrbitUnit = velocityVesselOrbit.normalized;
        Vector3d radialPlus = Vector3d.Exclude(velocityVesselOrbit, up).normalized;
        Vector3d velocityVesselSurface = velocityVesselOrbit - vessel.mainBody.getRFrmVel(CoM);
        Vector3d velocityVesselSurfaceUnit = velocityVesselSurface.normalized;

        RadialPlus = gymbal * radialPlus;
        NormalPlus = gymbal * -Vector3d.Cross(radialPlus, velocityVesselOrbitUnit);
        ProgradeOrbit = gymbal * velocityVesselOrbitUnit;
        ProgradeSurface = gymbal * velocityVesselSurfaceUnit;

        if (vessel.patchedConicSolver.maneuverNodes.Count > 0)
        {
            Vector3d burnVector = vessel.patchedConicSolver.maneuverNodes[0].GetBurnVector(vessel.orbit);
            ManeuverPlus = gymbal * burnVector.normalized;
            ManeuverPresent = true;
        }
        else
        {
            ManeuverPresent = false;
        }
    }
开发者ID:kujuman,项目名称:EnhancedNavBall,代码行数:29,代码来源:CalculationStore.cs


示例18: OnVesselRecoveryRequested

        public void OnVesselRecoveryRequested(Vessel v)
        {
            vesselMass = v.GetTotalMass();

            //Get total ship cost
            KerbalGUIManager.print("[rusty] OnVesselRecoveryRequested");
        }
开发者ID:MartynasStropa,项目名称:KSP_rusty,代码行数:7,代码来源:rustyRecoveryEvents.cs


示例19: getFreeLabsWithEquipment

 public override List<Lab> getFreeLabsWithEquipment(Vessel vessel)
 {
     List<Lab> ret = new List<Lab>();
     List<MPL_Module> allPhysicsLabs;
     if (cachedVesselID == vessel.id && partCount == vessel.parts.Count && physicsLabCache != null)
     {
         allPhysicsLabs = physicsLabCache;
     }
     else
     {
         allPhysicsLabs = new List<MPL_Module>(UnityFindObjectsOfType(typeof(MPL_Module)) as MPL_Module[]);
         physicsLabCache = allPhysicsLabs;
         cachedVesselID = vessel.id;
         partCount = vessel.parts.Count;
         NE_Helper.log("Lab Cache refresh");
     }
     foreach (MPL_Module lab in allPhysicsLabs)
     {
         if (lab.vessel == vessel && lab.hasEquipmentInstalled(neededEquipment) && lab.hasEquipmentFreeExperimentSlot(neededEquipment))
         {
             ret.Add(lab);
         }
     }
     return ret;
 }
开发者ID:N3h3miah,项目名称:OrbitalMaterialScience,代码行数:25,代码来源:MPL_ExperimentData.cs


示例20: update

 public void update(Vessel vessel)
 {
     if (vessel != null)
     {
         updateHasTelemachusPart(vessel);
     }
 }
开发者ID:kerbologna,项目名称:Telemachus,代码行数:7,代码来源:VesselChangeDetector.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Video类代码示例发布时间:2022-05-24
下一篇:
C# Vertices类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap