Exemple #1
0
        public static List <ShipHulls> GetShipHulls()
        {
            List <ShipHulls> ShipHulls = new List <ShipHulls>();

            using (SqlConnection sqlConn = DatabaseHelper.GetConnection())
                using (SqlCommand DBCmd = new SqlCommand("dbo.GetShipHulls", sqlConn))
                {
                    SqlDataReader sqlReader = default(SqlDataReader);
                    DBCmd.CommandType = CommandType.StoredProcedure;
                    sqlConn.Open();
                    sqlReader = DBCmd.ExecuteReader(CommandBehavior.CloseConnection);

                    while (sqlReader.Read())
                    {
                        ShipHulls ShipHull = new ShipHulls();
                        ShipHull.HullID        = sqlReader.GetInt32Nullable("HullID");
                        ShipHull.HullName      = sqlReader.GetString("HullName");
                        ShipHull.SortOrder     = sqlReader.GetInt32Nullable("SortOrder");
                        ShipHull.MaterialCost  = sqlReader.GetDoubleNullable("MaterialCost");
                        ShipHull.Hull          = sqlReader.GetDoubleNullable("Hull");
                        ShipHull.NumPods       = sqlReader.GetInt32Nullable("NumPods");
                        ShipHull.TechID        = sqlReader.GetInt32Nullable("TechID");
                        ShipHull.TechLevel     = sqlReader.GetInt32Nullable("TechLevel");
                        ShipHull.BuildingID    = sqlReader.GetInt32Nullable("BuildingID");
                        ShipHull.BuildingLevel = sqlReader.GetInt32Nullable("BuildingLevel");
                        ShipHull.RequiresBay   = sqlReader.GetBooleanNullable("RequiresBay");
                        ShipHulls.Add(ShipHull);
                    }
                    return(ShipHulls);
                }
        }
Exemple #2
0
        public void Update(float elapsedTime)
        {
            // Collides against outer boundries
            if (_boundingCube.Collides(CollisionSphere))
            {
                HandleCollision();
            }

            //Update direction
            _position += _direction;                       // *1 / SpaceShip.Scale;
            CollisionSphere.Center          += _direction; // *1 / BoundingBall.Scale;
            ShipHulls.ForEach(h => h.Center += _direction);

            if (Keyboard.GetState().IsKeyDown(Keys.H) && !_oldKeyState.IsKeyDown(Keys.H))
            {
                _showHull = !_showHull;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.B) && !_oldKeyState.IsKeyDown(Keys.B))
            {
                _showBall = !_showBall;
            }

            _oldKeyState = Keyboard.GetState();

            //update rotation
            _rotation.Update(elapsedTime);
            ShipHulls.ForEach(h => h.Rot = _rotation);

            Transform = Scale * _rotation.RotationMatrix * Matrix.CreateTranslation(_position);
        }