Пример #1
0
        internal override void ActionCommand(Game game)
        {
            if (!IsRunning)
            {
                (Vector3 pos, DateTime eti)targetIntercept = InterceptCalcs.GetInterceptPosition(_entityCommanding, _targetEntity.GetDataBlob <OrbitDB>(), TransitStartDateTime, TargetOffsetPosition_AU);
                OrbitDB orbitDB    = _entityCommanding.GetDataBlob <OrbitDB>();
                Vector3 currentPos = OrbitProcessor.GetAbsolutePosition_AU(orbitDB, TransitStartDateTime);
                var     ralPos     = OrbitProcessor.GetPosition_AU(orbitDB, TransitStartDateTime);
                var     masses     = _entityCommanding.GetDataBlob <MassVolumeDB>().Mass + orbitDB.Parent.GetDataBlob <MassVolumeDB>().Mass;
                var     sgp        = GameConstants.Science.GravitationalConstant * masses / 3.347928976e33;

                //Vector4 currentVec = OrbitProcessor.PreciseOrbitalVector(sgp, ralPos, orbitDB.SemiMajorAxis);
                Vector2 currentVec = OrbitProcessor.GetOrbitalVector(orbitDB, TransitStartDateTime);
                _db = new TranslateMoveDB(targetIntercept.pos);
                _db.TranslateRalitiveExit_AU = TargetOffsetPosition_AU;
                _db.EntryDateTime            = TransitStartDateTime;
                _db.PredictedExitTime        = targetIntercept.eti;
                _db.TranslateEntryPoint_AU   = currentPos;
                _db.SavedNewtonionVector_AU  = currentVec;

                _db.ExpendDeltaV_AU = ExpendDeltaV;
                if (_targetEntity.HasDataBlob <SensorInfoDB>())
                {
                    _db.TargetEntity = _targetEntity.GetDataBlob <SensorInfoDB>().DetectedEntity;
                }
                else
                {
                    _db.TargetEntity = _targetEntity;
                }
                if (EntityCommanding.HasDataBlob <OrbitDB>())
                {
                    EntityCommanding.RemoveDataBlob <OrbitDB>();
                }
                EntityCommanding.SetDataBlob(_db);
                TranslateMoveProcessor.StartNonNewtTranslation(EntityCommanding);
                IsRunning = true;


                var distance   = (currentPos - targetIntercept.Item1).Length();
                var distancekm = Distance.AuToKm(distance);

                var time = targetIntercept.Item2 - TransitStartDateTime;

                double spd = _entityCommanding.GetDataBlob <PropulsionAbilityDB>().MaximumSpeed_MS;
                spd = Distance.MToAU(spd);
                var distb   = spd * time.TotalSeconds;
                var distbKM = Distance.AuToKm(distb);

                var dif = distancekm - distbKM;
                //Assert.AreEqual(distancekm, distbKM);
            }
        }
Пример #2
0
 internal override void ActionCommand(Game game)
 {
     if (!IsRunning)
     {
         var targetIntercept = InterceptCalcs.GetInterceptPosition(_entityCommanding, _targetEntity.GetDataBlob <OrbitDB>(), _entityCommanding.Manager.ManagerSubpulses.StarSysDateTime);
         _db = new TranslateMoveDB(targetIntercept.Item1);
         _db.EntryDateTime          = _entityCommanding.Manager.ManagerSubpulses.StarSysDateTime;
         _db.PredictedExitTime      = targetIntercept.Item2;
         _db.TranslateEntryPoint_AU = _entityCommanding.GetDataBlob <PositionDB>().AbsolutePosition_AU;
         _db.TargetEntity           = _targetEntity;
         if (EntityCommanding.HasDataBlob <OrbitDB>())
         {
             EntityCommanding.RemoveDataBlob <OrbitDB>();
         }
         EntityCommanding.SetDataBlob(_db);
         TranslateMoveProcessor.StartNonNewtTranslation(EntityCommanding);
         IsRunning = true;
     }
 }