Пример #1
0
        private string getStatus(LocationContents loc)
        {
            string status = "";
            status += "position: " + loc.Position.ToString() + "\n";
            status += "pressure: " + loc.Pressure + "\n";
            status += "num cells: " + loc.TissueCells.Count + "\n";
            status += "num pipes: " + loc.pipes.Count + "\n";

            return status;
        }
Пример #2
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            if (runningSimulation)
            {
                environment.Tick(); // update simulation
                updateGraphs();
                executeInterferences();
            }

            if (allowMovement)
            {
                Rectangle clientBounds = Window.ClientBounds;
                int centerX = clientBounds.Width / 2;
                int centerY = clientBounds.Height / 2;
                Mouse.SetPosition(centerX, centerY);
            }

            if (environment != null)
            {
                view = camera.ViewMatrix;
                projection = camera.ProjectionMatrix;
                selection = calculateSelection(camera.CameraEye, camera.ViewDirection);

                drawSimulation();

                if (useSelection)
                {
                    Vector3 intSelection = new Vector3((int)selection.X, (int)selection.Y, (int)selection.Z);
                    drawSelection(intSelection);
                    if (environment.GoodPoint(intSelection))
                        selectedLocation = environment.GetContentsAt(intSelection);
                    else
                        selectedLocation = null;
                }

                if (showBlastCellCount)
                {
                    string text = "number of blast cells: " + environment.BlastCellTotal;
                    spriteBatch.Begin();
                    spriteBatch.DrawString(spriteFont, text, new Vector2(15, 15), Color.White);
                    spriteBatch.End();
                }
            }   // end if environment != null

            base.Draw(gameTime);
        }