CrisisAtSwissStation.DudeObject.Draw C# (CSharp) Method

Draw() public method

public Draw ( Matrix cameraTransform ) : void
cameraTransform Matrix
return void
        public override void Draw(Matrix cameraTransform)
        {
            //animation stuff

            //sourceRect = new Rectangle(xFrame * spriteWidth, yFrame * spriteHeight, spriteWidth, spriteHeight);
            //origin = new Vector2(sourceRect.Width / 2, sourceRect.Height / 2);

            Vector2 screenOffset = (CASSWorld.SCALE * Position);
            SpriteEffects flip = facingRight ? SpriteEffects.None : SpriteEffects.FlipHorizontally;

            SpriteBatch spriteBatch = GameEngine.Instance.SpriteBatch;
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default,
                              RasterizerState.CullCounterClockwise, null, cameraTransform);

            //Console.WriteLine("X {0} Y {1}",sourceRect.Width, sourceRect.Height);
            if (amDead)
            {
                spriteBatch.Draw(deadTexture, screenOffset, null, Color.White, 0, new Vector2(deadTexture.Width / 2, deadTexture.Height / 2), 1, SpriteEffects.None, 0);
            }
            else
            {
                //spriteBatch.Draw(animTexture, screenOffset, sourceRect, Color.White, Angle, origin, 1, flip, 0);
                spriteBatch.Draw(animTexture, screenOffset, sourceRect, Color.White, Angle, animOrigin, 1, flip, 0);

                //arm code
                if (facingRight)
                    spriteBatch.Draw(armTexture, screenOffset + new Vector2(-10, 0), null, Color.White, armAngle, armOrigin, .8f, flip, 0);
                else
                {
                    if (armAngle < -1.5) armAngle = -armAngle;//for corner cases
                    // if (armAngle > 1.5) armAngle = -armAngle;
                    spriteBatch.Draw(armTexture, screenOffset + new Vector2(0, 0), null, Color.White, armAngle, armOrigin, .8f, flip, 0);
                    // spriteBatch.Draw(armTexture, screenOffset + new Vector2(0, 0), null, Color.White, armAngle, armOrigin - new Vector2(-10, -10), .8f, flip, 0);
                }
                //Console.WriteLine("{0}", armAngle);
            }

            spriteBatch.End();

            /*
            Vector2 origin = new Vector2(texture.Width, texture.Height) / 2;
            Vector2 screenOffset = (CASSWorld.SCALE * Position) - offset;

            SpriteEffects flip = facingRight ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
            SpriteBatch spriteBatch = GameEngine.Instance.SpriteBatch;
            spriteBatch.Begin();

            spriteBatch.Draw(texture, screenOffset, null, Color.White, Angle, origin, 1, flip, 0);

            spriteBatch.End();*/
        }