Beispiel #1
0
 void Entity_ChangeEvent(EntityChangeData.EntityChangeType changeType, BaseDataBlob db)
 {
     if (changeType == EntityChangeData.EntityChangeType.DBAdded)
     {
         if (db is OrbitDB)
         {
             _orbitDB = (OrbitDB)db;
             var i    = Angle.ToRadians(_orbitDB.Inclination);
             var aop  = Angle.ToRadians(_orbitDB.ArgumentOfPeriapsis);
             var loan = Angle.ToRadians(_orbitDB.LongitudeOfAscendingNode);
             _lop = (float)OrbitMath.GetLongditudeOfPeriapsis(i, aop, loan);
         }
         else if (db is TranslateMoveDB)
         {
             _tlmoveDB = (TranslateMoveDB)db;
         }
     }
     else if (changeType == EntityChangeData.EntityChangeType.DBRemoved)
     {
         if (db is OrbitDB)
         {
             _orbitDB = null;
         }
         else if (db is TranslateMoveDB)
         {
             _tlmoveDB = null;
         }
     }
 }
Beispiel #2
0
        public ShipIcon(Entity entity) : base(entity.GetDataBlob <PositionDB>())
        {
            _shipInfo           = entity.GetDataBlob <ShipInfoDB>();
            _componentInstances = entity.GetDataBlob <ComponentInstancesDB>();
            if (entity.HasDataBlob <OrbitDB>())
            {
                _orbitDB = entity.GetDataBlob <OrbitDB>();
                var i    = Angle.ToRadians(_orbitDB.Inclination);
                var aop  = Angle.ToRadians(_orbitDB.ArgumentOfPeriapsis);
                var loan = Angle.ToRadians(_orbitDB.LongitudeOfAscendingNode);
                _lop = (float)OrbitMath.GetLongditudeOfPeriapsis(i, aop, loan);
            }
            else if (entity.HasDataBlob <NewtonMoveDB>())
            {
                _newtonMoveDB = entity.GetDataBlob <NewtonMoveDB>();
            }
            else if (entity.HasDataBlob <TranslateMoveDB>())
            {
                _tlmoveDB = entity.GetDataBlob <TranslateMoveDB>();
            }
            entity.ChangeEvent += Entity_ChangeEvent;



            _entity = entity;
            BasicShape();
            OnPhysicsUpdate();
        }