Example #1
0
 public Color EffectColor()
 {
     if (baby == null)
     {
         return(Color.Yellow);
     }
     return(new Color((int)baby.Attributes()["redColor"], (int)baby.Attributes()["greenColor"], (int)baby.Attributes()["blueColor"]));
 }
Example #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            antSprite        = Content.Load <Texture2D>("antRealistic");
            antSpriteAlt     = Content.Load <Texture2D>("antTransparent2");
            foodSprite       = Content.Load <Texture2D>("food");
            backgroundSprite = Content.Load <Texture2D>("greenNoise");
            cursorSprite     = Content.Load <Texture2D>("cursorSheet2");

            font         = Content.Load <SpriteFont>("font");
            statMenuFont = Content.Load <SpriteFont>("statMenuFont");

            // initialize
            foreach (KeyValuePair <string, double> kvp in attributes)
            {
                Statistics.firstAverages[kvp.Key] = 0;
                Statistics.currentSum[kvp.Key]    = 0;
            }

            for (int i = 0; i < STARTING_ANTS; i++)
            {
                Vector2 pos = new Vector2((int)rng.Next(GRID_WIDTH), (int)rng.Next(GRID_HEIGHT));

                //  half of the starting ants are mutants, half are not
                Ant ant = new Ant(attributes, rng, grid, i % 2 == 0);
                grid[(int)pos.X, (int)pos.Y] = ant;

                foreach (KeyValuePair <string, double> kvp in attributes)
                {
                    Statistics.firstAverages[kvp.Key] += ant.Attributes()[kvp.Key] / STARTING_ANTS;
                }

                grid[(int)pos.X, (int)pos.Y].SetPosition(pos);
                grid[(int)pos.X, (int)pos.Y].SetSprite(antSprite);
            }
            string trunc = "";

            for (int i = 0; i < TRUNCATED_STRING_LIMIT; i++)
            {
                trunc += "a";
            }
            AVERAGES_BAR_OFFSET_WIDTH = (int)statMenuFont.MeasureString(trunc).X;
        }
Example #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            antSprite = Content.Load<Texture2D>("antRealistic");
            antSpriteAlt = Content.Load<Texture2D>("antTransparent2");
            foodSprite = Content.Load<Texture2D>("food");
            backgroundSprite = Content.Load<Texture2D>("greenNoise");
            cursorSprite = Content.Load<Texture2D>("cursorSheet2");

            font = Content.Load<SpriteFont>("font");
            statMenuFont = Content.Load<SpriteFont>("statMenuFont");

            // initialize
            foreach (KeyValuePair<string, double> kvp in attributes)
            {
                Statistics.firstAverages[kvp.Key] = 0;
                Statistics.currentSum[kvp.Key] = 0;
            }

            for (int i = 0; i < STARTING_ANTS; i++)
            {
                Vector2 pos = new Vector2((int) rng.Next(GRID_WIDTH), (int) rng.Next(GRID_HEIGHT));

                //  half of the starting ants are mutants, half are not
                Ant ant = new Ant(attributes, rng, grid, i%2==0);
                grid[(int)pos.X, (int)pos.Y] = ant;

                foreach (KeyValuePair<string, double> kvp in attributes)
                {
                    Statistics.firstAverages[kvp.Key] += ant.Attributes()[kvp.Key] / STARTING_ANTS;
                }

                grid[(int)pos.X, (int)pos.Y].SetPosition(pos);
                grid[(int)pos.X, (int)pos.Y].SetSprite(antSprite);
            }
            string trunc = "";
            for (int i = 0; i < TRUNCATED_STRING_LIMIT; i++)
            {
                trunc += "a";
            }
            AVERAGES_BAR_OFFSET_WIDTH = (int)statMenuFont.MeasureString(trunc).X;
        }