/// <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); //Load the player resources Vector2 playerPosition = new Vector2(400, 450); //Load the wall resources Vector2 wallPosition = new Vector2(190.0f, 240.0f); scale = new Vector2(1, 1); //Load the feeler resources Vector2 feelerPosition = new Vector2(playerPosition.X - 55, playerPosition.Y - 50); wall.Initialize(Content.Load <Texture2D>("bigwall"), wallPosition); feeler.Initialize(Content.Load <Texture2D>("3feelers"), feelerPosition); // radar.Initialize(Content.Load<Texture2D>("Radar"), playerPosition); //NEW: foodManager = new FoodManager(Content.Load <Texture2D>("food")); wallManager = new WallManager(); wallManager.addWall(wall); foodLocation = new Vector2(300, 100); foodManager.addFood(foodLocation.X, foodLocation.Y); //Load the text font = Content.Load <SpriteFont>("myFont"); inputs = new double[6]; output = new double[2]; network = new NetworkManager(); for (int i = 0; i < 20; i++) { network.addNetwork(6, this.r); player.addPlayer(); } player.Initialize(Content.Load <Texture2D>("theplayer"), playerPosition); // TODO: use this.Content to load your game content here }
public void determineActivations(List <Food> enemy, Player player, float playerAngle, FoodManager foodManager) { float distance2; float sinx; float cosy; cbottomrightlevel = 0; ctopleftlevel = 0; ctoprightlevel = 0; cbottomleftlevel = 0; bottomrightlevel = 0; topleftlevel = 0; toprightlevel = 0; bottomleftlevel = 0; if (enemy.Count < 1) { return; } playerslope = (float)Math.Tan((double)playerAngle); for (int i = 0; i < enemy.Count; i++) { Food current = enemy.ElementAt(i); if (current.relativeAngle >= 0 && current.relativeAngle < 90) { ctopleftlevel++; } else if (current.relativeAngle >= 90 && current.relativeAngle < 180) { cbottomleftlevel++; } else if (current.relativeAngle >= 180 && current.relativeAngle < 270) { cbottomrightlevel++; } else { ctoprightlevel++; } } if (ctoprightlevel != toprightlevel) { toprightlevel = ctoprightlevel; } if (cbottomrightlevel != bottomrightlevel) { bottomrightlevel = cbottomrightlevel; } if (ctopleftlevel != topleftlevel) { topleftlevel = ctopleftlevel; } if (cbottomleftlevel != bottomleftlevel) { bottomleftlevel = cbottomleftlevel; } }