public Game1() { graphics = new GraphicsDeviceManager(this); content = new ContentManager(Services); content.RootDirectory = "Content\\"; world = new World(Constants.DEFAULT_WORLD_X, Constants.DEFAULT_WORLD_Y, this); agents = new List<Agent>(); framesPerUpdate = Constants.START_FRAMES_PER_SIM_UPDATE; frameCount = 0; totalFrames = 0; }
public Agent(int x, int y, int sugar, int lifespan, int metabolism, int vision, World world) { posx = x; posy = y; this.sugar = sugar; this.start_sugar = sugar; this.lifespan = lifespan; this.metabolism = metabolism; this.vision = vision; this.world = world; alive = true; age = 0; culture = new byte[Constants.CULTURAL_TAG_LENGTH]; for (int i = 0; i < Constants.CULTURAL_TAG_LENGTH; i++) { culture[i] = (byte) r.Next(2); } calculateColor(); }
public Agent(int x, int y, int sugar, int lifespan, int metabolism, int vision, World world, byte[] culture) { posx = x; posy = y; this.sugar = sugar; //if (sugar <= Constants.INITIAL_SUGAR_MAX) { this.start_sugar = sugar; //} else { // this.start_sugar = Constants.INITIAL_SUGAR_MAX; //} this.lifespan = lifespan; this.metabolism = metabolism; this.vision = vision; this.world = world; alive = true; age = 0; this.culture = culture; calculateColor(); }
public void drawWorld(World w) { spritebatch.Begin(); for (int i = 0; i < w.xSize; i++) { for (int j = 0; j < w.ySize; j++) { Vector2 cellPosition = new Vector2(i * cellTexture.Width, j * cellTexture.Height); cellPosition *= zoomLevel; //spritebatch.Draw(cellTexture, Vector2.Add(cameraPosition, cellPosition), Color.Multiply(Color.White, (float) w.seeCell(i, j).sugar / 15.0f)); spritebatch.Draw(cellTexture, Vector2.Add(cameraPosition, cellPosition), null, Color.Multiply(Color.White, (float)w.seeCell(i, j).sugar / 8.0f), 0.0f, new Vector2(), zoomLevel, SpriteEffects.None, 1.0f); } } spritebatch.End(); }