Ejemplo n.º 1
0
        private void DrawGeneralStats()
        {
            spriteBatch.Begin();
            Primitives2D.FillRectangle(spriteBatch, new Rectangle(0, 0, 300, 600), AdditionalColors.TRANSPARENTBLACK);
            spriteBatch.DrawString(Fonts.FontArial, "#: " + manager.Creatures.Count, new Vector2(20, 20), Color.Red);
            spriteBatch.DrawString(Fonts.FontArial, "D: " + manager.numberOfDeaths, new Vector2(20, 40), Color.Red);
            spriteBatch.DrawString(Fonts.FontArial, "max(G): " + Creature.maximumGeneration, new Vector2(20, 60), Color.Red);
            spriteBatch.DrawString(Fonts.FontArial, "Y: " + manager.year, new Vector2(20, 80), Color.Red);
            spriteBatch.DrawString(Fonts.FontArial, "LS: " + Creature.oldestCreatureEver.Age + " g: " + Creature.oldestCreatureEver.Generation, new Vector2(20, 100), Color.Red);
            spriteBatch.DrawString(Fonts.FontArial, "LSA: " + manager.OldestCreatureAlive.Age + " g: " + manager.OldestCreatureAlive.Generation, new Vector2(20, 120), Color.Red);
            if (manager.AverageAgeOfLastCreaturesAccurate)
            {
                float averageDeathAge = manager.CalculateAverageAgeOfLastDeadCreatures();
                manager.AverageDeathAgeRecord.Add(averageDeathAge);
                spriteBatch.DrawString(Fonts.FontArial, "AvgDA: " + averageDeathAge, new Vector2(20, 140), Color.Red);
            }

            if (EvoGame.Instance.inputManager.EnableFastForward)
            {
                spriteBatch.DrawString(Fonts.FontArial, "Graph rendering disabled", new Vector2(20, 180), Color.Red);
                spriteBatch.DrawString(Fonts.FontArial, "during fast forward!", new Vector2(20, 200), Color.Red);
            }
            else
            {
                spriteBatch.DrawString(Fonts.FontArial, "Creatures Alive Graph ", new Vector2(20, 180), Color.Red);
                GraphRenderer.RenderGraph(spriteBatch, new Rectangle(20, 200, 260, 100), Color.Blue, manager.AliveCreaturesRecord, Fonts.FontArial, true);
                spriteBatch.DrawString(Fonts.FontArial, "Average Age on Death Graph ", new Vector2(20, 320), Color.Red);
                if (manager.AverageAgeOfLastCreaturesAccurate)
                {
                    GraphRenderer.RenderGraph(spriteBatch, new Rectangle(20, 340, 260, 100), Color.Red, manager.AverageDeathAgeRecord, Fonts.FontArial, true);
                }
                spriteBatch.DrawString(Fonts.FontArial, "Food Available Graph ", new Vector2(20, 460), Color.Red);
                GraphRenderer.RenderGraph(spriteBatch, new Rectangle(20, 480, 260, 100), Color.Green, manager.simulation.TileMap.FoodRecord, Fonts.FontArial, true);
            }

            selectedCreature = manager.SelectedCreature;

            if (selectedCreature != null)
            {
                Primitives2D.FillRectangle(spriteBatch, new Rectangle(800, 0, 500, 450), AdditionalColors.TRANSPARENTBLACK);

                spriteBatch.DrawString(Fonts.FontArial, "Selected Creature: ", new Vector2(820, 50), Color.Red);
                spriteBatch.DrawString(Fonts.FontArial, "A: " + selectedCreature.Age, new Vector2(820, 70), Color.Red);
                spriteBatch.DrawString(Fonts.FontArial, "E: " + selectedCreature.Energy, new Vector2(820, 90), Color.Red);
                spriteBatch.DrawString(Fonts.FontArial, "C: " + selectedCreature.Children.Count, new Vector2(820, 110), Color.Red);
                spriteBatch.DrawString(Fonts.FontArial, "G: " + selectedCreature.Generation, new Vector2(820, 130), Color.Red);
                spriteBatch.DrawString(Fonts.FontArial, "S: " + (selectedCreature.Energy > 100 ? "Alive" : "Dead"), new Vector2(820, 150), Color.Red);
                DrawCreature(selectedCreature, selectedCreature.Pos * -1 + new Vector2(1050, 70));
                networkRenderer.Network = selectedCreature.Brain;
                networkRenderer.Draw(spriteBatch, new Rectangle(950, 160, 200, 250));
            }

            spriteBatch.End();
        }
Ejemplo n.º 2
0
        private void EvoSimControl1_OnUpdate(Microsoft.Xna.Framework.GameTime obj)
        {
            string status = "#: {0} D: {1} max(G): {2} Y: {3} LS: {4} LSA: {5} AvgDA: {6}";

            status = string.Format(
                status,
                CreatureManager.Creatures.Count,
                CreatureManager.numberOfDeaths,
                CreatureManager.MaxGeneration,
                (CreatureManager.Tick * CreatureManager.FixedUpdateTime).ToString("0.00"),
                (Creature.oldestCreatureEver != null ?
                 Creature.oldestCreatureEver.Age :
                 0).ToString("0.00"),
                (CreatureManager.OldestCreatureAlive != null ?
                 CreatureManager.OldestCreatureAlive.Age :
                 0).ToString("0.00"),
                CreatureManager.CalculateAverageAgeOfLastDeadCreatures());
            toolStripStatusLabel1.Text = status;
        }