예제 #1
0
 public NewtonionOrderUI(NewtonThrustAbilityDB newtonAbility, double currentMass)
 {
     _exhastVelocity = newtonAbility.ExhaustVelocity;
     _fuelRate       = newtonAbility.FuelBurnRate;
     _maxDV          = newtonAbility.DeltaV;
     _curmass        = currentMass;
 }
예제 #2
0
        private void HardRefresh(EntityState orderEntity)
        {
            _orderEntity  = orderEntity.Entity;
            _newtonThrust = _orderEntity.GetDataBlob <NewtonThrustAbilityDB>();
            var myMass     = _orderEntity.GetDataBlob <MassVolumeDB>().MassDry;
            var parentMass = Entity.GetSOIParentEntity(_orderEntity).GetDataBlob <MassVolumeDB>().MassDry;

            _sgp = OrbitMath.CalculateStandardGravityParameterInM3S2(myMass, parentMass);

            _siblingEntities = Entity.GetSOIParentEntity(_orderEntity).GetDataBlob <PositionDB>().Children.ToArray();
            List <string> names = new List <string>();

            foreach (var entity in _siblingEntities)
            {
                //TODO: this is going to show *all* entities, not just the ones this faction can see.
                //going to need to come up with a way to get this data. (filtering for this should be done in the engine not ui)
                string name = entity.GetDataBlob <NameDB>().GetName(_orderEntity.FactionOwner);
                names.Add(name);
            }

            _siblingNames = names.ToArray();

            OnSystemTickChange(orderEntity.Entity.StarSysDateTime);
        }
예제 #3
0
        public void TestNewtonTrajectory()
        {
            Game          game         = new Game();
            EntityManager mgr          = new EntityManager(game, false);
            Entity        parentEntity = TestingUtilities.BasicEarth(mgr);

            PositionDB pos1 = new PositionDB(mgr.ManagerGuid, parentEntity)
            {
                X_AU = 0, Y_AU = 8.52699302490434E-05, Z_AU = 0
            };
            var newt1 = new NewtonMoveDB(parentEntity, new Vector3(-10.0, 0, 0))
            {
                DeltaVForManuver_FoRO_m = new Vector3(0, 1, 0)
            };

            BaseDataBlob[] objBlobs1 = new BaseDataBlob[4];
            objBlobs1[0] = pos1;
            objBlobs1[1] = new MassVolumeDB()
            {
                MassDry = 10000
            };
            objBlobs1[2] = new NewtonThrustAbilityDB(mgr.ManagerGuid);
            objBlobs1[3] = newt1;
            Entity objEntity1 = new Entity(mgr, objBlobs1);


            PositionDB pos2 = new PositionDB(mgr.ManagerGuid, parentEntity)
            {
                X_AU = 0, Y_AU = 8.52699302490434E-05, Z_AU = 0
            };
            var newt2 = new NewtonMoveDB(parentEntity, new Vector3(-10.0, 0, 0))
            {
                DeltaVForManuver_FoRO_m = new Vector3(0, 1, 0)
            };

            BaseDataBlob[] objBlobs2 = new BaseDataBlob[4];
            objBlobs2[0] = pos2;
            objBlobs2[1] = new MassVolumeDB()
            {
                MassDry = 10000
            };
            objBlobs2[2] = new NewtonThrustAbilityDB(mgr.ManagerGuid);
            objBlobs2[3] = newt2;
            Entity objEntity2 = new Entity(mgr, objBlobs2);

            var seconds = 100;

            for (int i = 0; i < seconds; i++)
            {
                NewtonionMovementProcessor.NewtonMove(objEntity1, 1);

                //this is a hacky way to allow us to increment each second,
                //since the above method looks at the manager datetime and we're not updating that.
                newt1.LastProcessDateTime -= TimeSpan.FromSeconds(1);
            }
            NewtonionMovementProcessor.NewtonMove(objEntity2, seconds);
            var distance1 = (pos1.RelativePosition_m.Length());
            var distance2 = (pos2.RelativePosition_m.Length());

            Assert.AreEqual(distance1, distance2); //if we put the variable timstep which is related to the speed of the object in we'll have to give this a delta
        }