Пример #1
0
        public override MovementOrderBase PrepareIntercept(IEntityLookup entityLookup, Point currentAbsolutePosition, double maxSpeedPerTick, TimePoint currentTime)
        {
            if (InterceptPoint.HasValue)
            {
                return(null);
            }

            MoveToOrbitalBodyOrder newOrder = null;
            var targetEntity     = entityLookup.GetEntity(TargetEntityId);
            var targetOrders     = targetEntity.GetOptionalComponent <OrdersComponent>();
            var targetUnitDesign = targetEntity.GetOptionalComponent <OrbitalUnitDesignComponent>();

            if (MovementOrderUtility.CanExecuteOrders(targetOrders, targetUnitDesign))
            {
                throw new NotImplementedException();
            }
            else
            {
                var speedPerTick   = Math.Min(SpeedPerTick, maxSpeedPerTick);
                var interceptPoint = MovementOrderUtility.GetInterceptPoint(entityLookup, currentAbsolutePosition, speedPerTick, targetEntity, currentTime);
                newOrder = CloneWithIntercept(interceptPoint);
            }

            return(newOrder);
        }
Пример #2
0
 private MoveToOrbitalBodyOrder([NotNull] MoveToOrbitalBodyOrder that, Point?interceptPoint)
     : base(that)
 {
     TargetEntityId = that.TargetEntityId;
     SpeedPerTick   = that.SpeedPerTick;
     InterceptPoint = interceptPoint;
 }