Esempio n. 1
0
        private void MainWindow_Paint(object sender, PaintEventArgs e)
        {
            Graphics graphics = e.Graphics;

            //Update the position of the camera
            mRenderer.cameraLocation = (mScene.thePlayer.playerBody.Position - new Physics.Vector2D(GlobalConstants.WINDOW_WIDTH / 2, GlobalConstants.WINDOW_HEIGHT / 2)) * -1;
            //Do not allow the camera below a certain position
            if (mRenderer.cameraLocation.Y < 0)
            {
                mRenderer.cameraLocation.Y = 0;
            }


            //draw all AI spawn locations
            foreach (Physics.Vector2D spawn in mScene.theAIManager.AISpawnLocations)
            {
                mRenderer.DrawAISpawn(spawn, graphics);
            }

            //Draw all physical objects in the scene
            foreach (var prop in mScene.thePhysicsEngine.dynamicPhysicsObjects)
            {
                mRenderer.Draw(prop, graphics);
            }
            foreach (var prop in mScene.thePhysicsEngine.staticPhysicsObjects)
            {
                mRenderer.Draw(prop, graphics);
            }

            //draw all spring joints
            foreach (var spring in mScene.thePhysicsEngine.springs)
            {
                mRenderer.DrawLine(spring.BodyA.Position, spring.BodyB.Position, graphics);
            }


            //draw any debug information to the screen
            dbgDisp.DisplayDebugGraphics(graphics);

            //Draw the HUD
            mScene.headsUpDisplay.DrawUI(mRenderer, graphics);
        }
Esempio n. 2
0
        //Write the state that each AI agent is currently in to the left of the screen
        private void DrawAIState(Graphics displayDevice)
        {
            Physics.Vector2D drawLocation = new Physics.Vector2D(10, 10);
            foreach (AI.AIEngine AIbrain in mAImanager.aiControllers)
            {
                //setup the string to be written
                string currentState = "NULL";
                switch (AIbrain.currentState)
                {
                case AI.STATES.WAITING:
                    currentState = "waiting";
                    break;

                case AI.STATES.WALKING:
                    currentState = "walking";
                    break;

                case AI.STATES.JUMPING:
                    currentState = "jumping";
                    break;

                case AI.STATES.FALLING:
                    currentState = "falling";
                    break;
                }

                //write the string
                mRenderer.Draw(currentState, drawLocation, displayDevice);

                //update the position to draw to
                drawLocation.Y += 20;
            }
        }
Esempio n. 3
0
 //draw all the UI information
 public void DrawUI(SimpleRenderer aRenderer, Graphics g)
 {
     aRenderer.Draw(message, messageLocation, g, messageColour);
     aRenderer.Draw("Time: " + ((int)timeRunning).ToString(), timerLocation, g);
     aRenderer.Draw("Lives: " + livesLeft.ToString(), livesLocation, g);
 }