コード例 #1
0
        public void drawgame(GameTime gameTime)
        {
            // Draw the in-game graphics
            sfunctions3d.resetgraphics(GraphicsDevice);

            // Draw the ground & walls
            for (int i = 0; i < numberofgrounds; i++)
            {
                ground[i].drawme(gamecamera, false);
            }

            for (int i = 0; i < numberofbullets; i++)
            {
                playerbullet[i].drawme(gamecamera, true);
            }

            for (int i = 0; i < numberofwalls; i++)
            {
                leftwall[i].drawme(gamecamera, false);
                rightwall[i].drawme(gamecamera, false);
            }

            // Draw the robot
            playerchar.drawme(gamecamera, true);

            // Draw the Zombies
            for (int i = 0; i < numberofzombs; i++)
            {
                if (Math.Abs(playerchar.position.Z - zombies[i].position.Z) < 10000)
                {
                    zombies[i].drawme(gamecamera, true);
                }
            }



            DebugShapeRenderer.Draw(gameTime, gamecamera.getview(), gamecamera.getproject());


            spriteBatch.Begin();
            //Draw the arrows for controls
            up.drawme(ref spriteBatch);
            down.drawme(ref spriteBatch);
            left.drawme(ref spriteBatch);
            right.drawme(ref spriteBatch);

            if (bulletcount <= 0)
            {
                firebut.drawme(ref spriteBatch);
            }


            //spriteBatch.DrawString(mainfont, "Res " + displaywidth.ToString() + " " + displayheight.ToString() + " Pos X:" + uservehicle.position.X.ToString("00000") + " Y:" + uservehicle.position.Y.ToString("00000") + " Z:" + uservehicle.position.Z.ToString("00000"),
            //    new Vector2(20, 60), Color.Yellow, MathHelper.ToRadians(0), new Vector2(0, 0), 0.5f, SpriteEffects.None, 0);

            //spriteBatch.DrawString(mainfont, "Accelerometer X:" + acc.X.ToString("0.00") + " Y:" + acc.Y.ToString("0.00") + " Z:" + acc.Z.ToString("0.00") + " Game Time:" + (gameruntime / 1000).ToString("0"),
            //    new Vector2(20, 80), Color.Yellow, MathHelper.ToRadians(0), new Vector2(0, 0), 0.5f, SpriteEffects.None, 0);

            spriteBatch.DrawString(mainfont, "Score: " + score.ToString(), new Vector2(625, 10),
                                   Color.LightGreen, MathHelper.ToRadians(0), new Vector2(0, 0), 0.75f, SpriteEffects.None, 0);

            spriteBatch.DrawString(mainfont, "Health: " + health.ToString(), new Vector2(10, 10),
                                   Color.LightGreen, MathHelper.ToRadians(0), new Vector2(0, 0), 0.75f, SpriteEffects.None, 0);


            spriteBatch.DrawString(mainfont, "Survive for as long as possible!", new Vector2((displaywidth / 2) - 200, displayheight - 35),
                                   Color.LightGreen, MathHelper.ToRadians(0), new Vector2(0, 0), 0.75f, SpriteEffects.None, 0);

            if (gameover)
            {
                backgroundGO.drawme(ref spriteBatch);
            }

            spriteBatch.End();
        }