spaceconquest.Ship.Draw C# (CSharp) Method

Draw() public method

public Draw ( Microsoft world, Microsoft view, Microsoft projection ) : void
world Microsoft
view Microsoft
projection Microsoft
return void
        public override void Draw(Microsoft.Xna.Framework.Matrix world, Microsoft.Xna.Framework.Matrix view, Microsoft.Xna.Framework.Matrix projection)
        {
            if (shipmodel == null) { Console.WriteLine(getprefix() + modelstring); shipmodel = ShipModel.shipmodels[getprefix() + modelstring]; }

            //Console.WriteLine(angle);

            //update current angle, and hmove it closer to the target angle,
            double angleIncr = (Math.PI / 25.0);

            if (Math.Abs(currentAngle - targetangle) > (Math.PI / 20.0))
            {
                //Then we need to modify depending on angle difference
                if (currentAngle < targetangle)
                {
                    currentAngle += angleIncr;
                }
                else
                {
                    currentAngle -= angleIncr;
                }
            }
            else
            {
                if (targetangles.Count() != 0)
                {
                    if (percenttraveled == 100) targetangle = targetangles.Dequeue();
                }

                if (percenttraveled < 100) { percenttraveled = percenttraveled + 4; }
                else
                {
                    if (targetpositions.Count() != 0)
                    {
                        percenttraveled = 0; oldposition = targetvector; targetvector = targetpositions.Dequeue();
                    }
                    else
                    {
                        targetvector = hex.getCenter();
                    }
                }
            }

            //Console.WriteLine("percenttaveled :: {0} ", percenttraveled);

            Vector3 currentvector = (targetvector - oldposition) * (percenttraveled / 100.0f) + oldposition;
            //Console.WriteLine("current vector :: {0} \n target vector :: {1} ", currentvector, targetvector);

            //Create translation gets hex world coordinates
            if (affiliation != null)
            {
                shipmodel.Draw(Matrix.CreateRotationZ((float)currentAngle) * Matrix.CreateTranslation(currentvector) * world, view, projection, affiliation.color, 1.6f, hoveringHeight);
            }
            else
            {
                shipmodel.Draw(Matrix.CreateRotationZ((float)currentAngle) * Matrix.CreateTranslation(currentvector) * world, view, projection, Color.Black, 1.6f, hoveringHeight);
            }
            //create illusion that ship is hovering in space
            hoveringHeight += hoveringAcc;
            if (hoveringHeight > 13 || hoveringHeight < 6) { hoveringAcc *= -1; }
        }