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


C# Speed.GetUnitsPerHour方法代码示例

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


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

示例1: ChangeSpeed_Internal

 /// <summary>
 /// Internal control that changes the speed the ship is currently traveling at. 
 /// This version does not disengage the autopilot.
 /// </summary>
 /// <param name="newSpeed">The new speed.</param>
 /// <param name="moveMode">The move mode.</param>
 private void ChangeSpeed_Internal(Speed newSpeed, bool isFleetSpeed) {
     float newSpeedValue = isFleetSpeed ? newSpeed.GetUnitsPerHour(_ship.Command.Data) : newSpeed.GetUnitsPerHour(_ship.Data);
     _engineRoom.ChangeSpeed(newSpeed, newSpeedValue);
     if (IsPilotEngaged) {
         _isApCurrentSpeedFleetwide = isFleetSpeed;
     }
 }
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:13,代码来源:ShipItem.cs

示例2: 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

示例3: ChangeSpeed

 /// <summary>
 /// Changes the speed of the ship.
 /// </summary>
 /// <param name="newSpeed">The new speed request.</param>
 /// <returns><c>true</c> if the speed change was accepted.</returns>
 public bool ChangeSpeed(Speed newSpeed) {
     if (DebugSettings.Instance.StopShipMovement) {
         DisengageAutoPilot();
         return false;
     }
     return _engineRoom.ChangeSpeed(newSpeed.GetUnitsPerHour(_ship.Command.Data, _ship.Data));
 }
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:12,代码来源:ShipModel.cs


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