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


C# Speed.GetValueName方法代码示例

本文整理汇总了C#中Speed.GetValueName方法的典型用法代码示例。如果您正苦于以下问题:C# Speed.GetValueName方法的具体用法?C# Speed.GetValueName怎么用?C# Speed.GetValueName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Speed的用法示例。


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

示例1: ExecuteAssumeStationOrder_EnterState

    IEnumerator ExecuteAssumeStationOrder_EnterState() {
        LogEvent();

        TryBreakOrbit();
        _helm.ChangeSpeed(Speed.Stop);

        if (IsHQ) {
            D.Assert(FormationStation.IsOnStation);
            if (CurrentOrder.ToNotifyCmd) {
                Command.HandleOrderOutcome(CurrentOrder.Directive, this, isSuccess: true);
            }
            CurrentState = ShipState.Idling;
            yield return null;
        }

        _apMoveSpeed = Speed.Standard;

        if (ShowDebugLog) {
            string speedMsg = "{0}({1:0.##}) units/hr".Inject(_apMoveSpeed.GetValueName(), _apMoveSpeed.GetUnitsPerHour(Data));
            D.Log("{0} is initiating repositioning to FormationStation at speed {1}. DistanceToStation: {2:0.##}.",
                DebugName, speedMsg, FormationStation.DistanceToStation);
        }

        Call(ShipState.Moving);
        yield return null;  // required so Return()s here

        if (_orderFailureCause != UnitItemOrderFailureCause.None) {
            if (CurrentOrder.ToNotifyCmd) {
                Command.HandleOrderOutcome(CurrentOrder.Directive, this, isSuccess: false, failCause: _orderFailureCause);
            }
            switch (_orderFailureCause) {
                case UnitItemOrderFailureCause.UnitItemNeedsRepair:
                    InitiateRepair(retainSuperiorsOrderOnRepairCompletion: false);
                    break;
                case UnitItemOrderFailureCause.UnitItemDeath:
                    // Dead state will follow
                    break;
                case UnitItemOrderFailureCause.TgtUncatchable:
                case UnitItemOrderFailureCause.TgtDeath:
                case UnitItemOrderFailureCause.TgtRelationship:
                case UnitItemOrderFailureCause.TgtUnreachable:
                default:
                    throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(_orderFailureCause));
            }
            yield return null;
        }
        if (FormationStation.IsOnStation) {
            D.Log(ShowDebugLog, "{0} has reached its formation station.", DebugName);
        }
        else {
            D.Warn("{0} has exited 'Moving' to its formation station without being on station.", DebugName);
        }

        // If there was a failure generated by Moving, resulting new Orders or Dead state should keep this point from being reached
        D.AssertDefault((int)_orderFailureCause, _orderFailureCause.GetValueName());

        // No need to wait for HQ to stop turning as we are aligning with its intended facing
        Vector3 hqIntendedHeading = Command.HQElement.Data.IntendedHeading;
        _helm.ChangeHeading(hqIntendedHeading, headingConfirmed: () => {
            Speed hqSpeed = Command.HQElement.CurrentSpeedSetting;
            _helm.ChangeSpeed(hqSpeed);  // UNCLEAR always align speed with HQ?
                                         //D.Log(ShowDebugLog, "{0} has aligned heading and speed {1} with HQ {2}.", DebugName, hqSpeed.GetValueName(), Command.HQElement.DebugName);
            if (CurrentOrder.ToNotifyCmd) {
                Command.HandleOrderOutcome(CurrentOrder.Directive, this, isSuccess: true);
            }
            CurrentState = ShipState.Idling;
        });
    }
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:68,代码来源:ShipItem.cs

示例2: PlotCourse

 /// <summary>
 /// Plots the course to the target and notifies the requester of the outcome via the onCoursePlotSuccess or Failure events.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="travelSpeed">The speed to travel at.</param>
 public virtual void PlotCourse(INavigableTarget target, Speed travelSpeed, OrderSource orderSource) {
     D.Assert(travelSpeed != default(Speed) && travelSpeed != Speed.Stop && travelSpeed != Speed.EmergencyStop, "{0} speed of {1} is illegal.".Inject(Name, travelSpeed.GetValueName()));
     Target = target;
     TravelSpeed = travelSpeed;
     _orderSource = orderSource;
 }
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:11,代码来源:ANavigator2.cs

示例3: ChangeSpeed

 /// <summary>
 /// Primary exposed control that changes the speed of the ship and disengages the pilot.
 /// For use when managing the speed of the ship without relying on  the Autopilot.
 /// </summary>
 /// <param name="newSpeed">The new speed.</param>
 internal void ChangeSpeed(Speed newSpeed) {
     D.Assert(__ValidExternalChangeSpeeds.Contains(newSpeed), newSpeed.GetValueName());
     //D.Log(ShowDebugLog, "{0} is about to disengage pilot and change speed to {1}.", DebugName, newSpeed.GetValueName());
     DisengagePilot();
     ChangeSpeed_Internal(newSpeed, isFleetSpeed: false);
 }
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:11,代码来源:ShipItem.cs

示例4: EngagePilotToMoveTo

 /// <summary>
 /// Engages the pilot to move to the target using the provided proxy. It will notify the ship
 /// when it arrives via Ship.HandleTargetReached.
 /// </summary>
 /// <param name="apTgtProxy">The proxy for the target this Pilot is being engaged to reach.</param>
 /// <param name="speed">The initial speed the pilot should travel at.</param>
 /// <param name="isFleetwideMove">if set to <c>true</c> [is fleetwide move].</param>
 internal void EngagePilotToMoveTo(AutoPilotDestinationProxy apTgtProxy, Speed speed, bool isFleetwideMove) {
     Utility.ValidateNotNull(apTgtProxy);
     D.Assert(!InvalidApSpeeds.Contains(speed), speed.GetValueName());
     ApTargetProxy = apTgtProxy;
     ApSpeed = speed;
     _isApFleetwideMove = isFleetwideMove;
     _isApCurrentSpeedFleetwide = isFleetwideMove;
     _isApInPursuit = false;
     RefreshCourse(CourseRefreshMode.NewCourse);
     EngagePilot();
 }
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:18,代码来源:ShipItem.cs

示例5: RecordAutoPilotCourseValues

 /// <summary>
 /// Records the AutoPilot values needed to plot a course.
 /// </summary>
 /// <param name="autoPilotTgt">The target this AutoPilot is being engaged to reach.</param>
 /// <param name="autoPilotSpeed">The speed the autopilot should travel at.</param>
 protected void RecordAutoPilotCourseValues(INavigable autoPilotTgt, Speed autoPilotSpeed) {
     Utility.ValidateNotNull(autoPilotTgt);
     D.Assert(!_inValidAutoPilotSpeeds.Contains(autoPilotSpeed), "{0} speed of {1} for autopilot is invalid.".Inject(Name, autoPilotSpeed.GetValueName()));
     AutoPilotTarget = autoPilotTgt;
     AutoPilotSpeed = autoPilotSpeed;
 }
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:11,代码来源:AAutoPilot.cs

示例6: PlotCourse

        /// <summary>
        /// Plots the course to the target and notifies the requester of the outcome via the onCoursePlotSuccess or Failure events.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="speed">The speed.</param>
        public void PlotCourse(INavigableTarget target, Speed speed) {
            D.Assert(speed != default(Speed) && speed != Speed.Stop, "{0} speed of {1} is illegal.".Inject(_fleet.FullName, speed.GetValueName()));

            TryCheckForSystemAccessPoints(target, out _fleetSystemExitPoint, out _targetSystemEntryPoint);

            Target = target;
            FleetSpeed = speed;
            AssessFrequencyOfCourseProgressChecks();
            InitializeReplotValues();
            GenerateCourse();
        }
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:16,代码来源:FleetCmdModel.cs

示例7: PlotPilotCourse

        /// <summary>
        /// Plots the course to the target and notifies the requester of the outcome via the onCoursePlotSuccess or Failure events.
        /// </summary>
        /// <param name="apTgt">The target this AutoPilot is being engaged to reach.</param>
        /// <param name="apSpeed">The speed the autopilot should travel at.</param>
        /// <param name="apTgtStandoffDistance">The target standoff distance.</param>
        internal void PlotPilotCourse(IFleetNavigable apTgt, Speed apSpeed, float apTgtStandoffDistance) {
            Utility.ValidateNotNull(apTgt);
            D.Assert(!InvalidApSpeeds.Contains(apSpeed), apSpeed.GetValueName());
            ApTarget = apTgt;
            ApSpeedSetting = apSpeed;
            _apTgtStandoffDistance = apTgtStandoffDistance;

            IList<Vector3> directCourse;
            if (TryDirectCourse(out directCourse)) {
                // use this direct course
                //D.Log(ShowDebugLog, "{0} will use a direct course to {1}.", DebugName, ApTarget.DebugName);
                _isApCourseFromPath = false;
                ConstructApCourse(directCourse);
                HandleApCoursePlotSuccess();
            }
            else {
                _isApCourseFromPath = true;
                ResetPathReplotValues();
                PlotPath();
            }
        }
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:27,代码来源:FleetCmdItem.cs

示例8: PlotCourse

        /// <summary>
        /// Plots the course to the target and notifies the requester of the outcome via the onCoursePlotSuccess or Failure events.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="speed">The speed.</param>
        /// <param name="orderSource">The source of this move order.</param>
        public void PlotCourse(INavigableTarget target, Speed speed, OrderSource orderSource) {
            D.Assert(speed != default(Speed) && speed != Speed.Stop, "{0} speed of {1} is illegal.".Inject(_ship.FullName, speed.GetValueName()));

            // NOTE: I know of no way to check whether a target is unreachable at this stage since many targets move, 
            // and most have a closeEnoughDistance that makes them reachable even when enclosed in a keepoutZone

            if (target is IFormationStation) {
                D.Assert(orderSource == OrderSource.ElementCaptain);
                DestinationInfo = new ShipDestinationInfo(target as IFormationStation);
            }
            else if (target is SectorModel) {
                Vector3 destinationOffset = orderSource == OrderSource.UnitCommand ? _ship.Data.FormationStation.StationOffset : Vector3.zero;
                DestinationInfo = new ShipDestinationInfo(target as SectorModel, destinationOffset);
            }
            else if (target is StationaryLocation) {
                Vector3 destinationOffset = orderSource == OrderSource.UnitCommand ? _ship.Data.FormationStation.StationOffset : Vector3.zero;
                var autoPilotSpeedReference = new Reference<float>(() => _autoPilotSpeedInUnitsPerHour);
                DestinationInfo = new ShipDestinationInfo((StationaryLocation)target, destinationOffset, autoPilotSpeedReference);
            }
            else if (target is FleetCmdModel) {
                D.Assert(orderSource == OrderSource.UnitCommand);
                var fleetTarget = target as FleetCmdModel;
                bool isEnemy = _ship.Owner.IsEnemyOf(fleetTarget.Owner);
                DestinationInfo = new ShipDestinationInfo(fleetTarget, _ship.Data.FormationStation.StationOffset, isEnemy);
            }
            else if (target is AUnitBaseCmdModel) {
                D.Assert(orderSource == OrderSource.UnitCommand);
                var baseTarget = target as AUnitBaseCmdModel;
                bool isEnemy = _ship.Owner.IsEnemyOf(baseTarget.Owner);
                DestinationInfo = new ShipDestinationInfo(baseTarget, _ship.Data.FormationStation.StationOffset, isEnemy);
            }
            else if (target is FacilityModel) {
                D.Assert(orderSource == OrderSource.ElementCaptain);
                var facilityTarget = target as FacilityModel;
                bool isEnemy = _ship.Owner.IsEnemyOf(facilityTarget.Owner);
                DestinationInfo = new ShipDestinationInfo(facilityTarget, isEnemy);
            }
            else if (target is ShipModel) {
                D.Assert(orderSource == OrderSource.ElementCaptain);
                var shipTarget = target as ShipModel;
                bool isEnemy = _ship.Owner.IsEnemyOf(shipTarget.Owner);
                DestinationInfo = new ShipDestinationInfo(shipTarget, isEnemy);
            }
            else if (target is APlanetoidModel) {
                Vector3 destinationOffset = orderSource == OrderSource.UnitCommand ? _ship.Data.FormationStation.StationOffset : Vector3.zero;
                DestinationInfo = new ShipDestinationInfo(target as APlanetoidModel, destinationOffset);
            }
            else if (target is SystemModel) {
                Vector3 destinationOffset = orderSource == OrderSource.UnitCommand ? _ship.Data.FormationStation.StationOffset : Vector3.zero;
                DestinationInfo = new ShipDestinationInfo(target as SystemModel, destinationOffset);
            }
            else if (target is StarModel) {
                Vector3 destinationOffset = orderSource == OrderSource.UnitCommand ? _ship.Data.FormationStation.StationOffset : Vector3.zero;
                DestinationInfo = new ShipDestinationInfo(target as StarModel, destinationOffset);
            }
            else if (target is UniverseCenterModel) {
                Vector3 destinationOffset = orderSource == OrderSource.UnitCommand ? _ship.Data.FormationStation.StationOffset : Vector3.zero;
                DestinationInfo = new ShipDestinationInfo(target as UniverseCenterModel, destinationOffset);
            }
            else {
                D.Error("{0} of Type {1} not anticipated.", target.FullName, target.GetType().Name);
                return;
            }

            OrderSource = orderSource;
            AutoPilotSpeed = speed;
            RefreshNavigationalValues();
            OnCoursePlotSuccess();
        }
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:75,代码来源:ShipModel.cs


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