public static void sendShips(Team team, float percentageOfShips, Planet origin, Planet destination) { if (origin.ID != destination.ID) { int TotalShips = TeamManager.teamShipCount[0] + TeamManager.teamShipCount[1]; float value = (float)Math.Pow((double)(.0001f * TotalShips), (double)2) + 1; // this should be a log/exponential function so we can cap how many ships go out... need help implementing. int numShips = (int)(origin.shipCount * percentageOfShips*(1/value)); if (numShips <= 0) { numShips = 1; } if (numShips >= origin.shipCount) { numShips = (int)Math.Floor((double)origin.shipCount); for (int i = 0; i < numShips; i++) { Ship ship = new Ship(team, origin, destination, 1); EntityManager.Add(ship); } } else { if (value < origin.shipCount) { for (int i = 0; i < numShips; i++) { Ship ship = new Ship(team, origin, destination, value); EntityManager.Add(ship); } } else { for (int i = 0; i <origin.shipCount; i++) { Ship ship = new Ship(team, origin, destination, 1f); EntityManager.Add(ship); } } } } }
/// <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); // TODO: use this.Content to load your game content here // Carregando as imagens do jogo { //Imagem de background Textures.Add("back", Content.Load<Texture2D>("back")); //Imagens do ufo1 Textures.Add("ufo1", Content.Load<Texture2D>("Sprites/ufo1")); Textures.Add("exp1", Content.Load<Texture2D>("Sprites/exp1")); //Imagens do ufo2 Textures.Add("ufo2", Content.Load<Texture2D>("Sprites/ufo2")); Textures.Add("exp2", Content.Load<Texture2D>("Sprites/exp2")); //Imagens do ufo3 Textures.Add("ufo3", Content.Load<Texture2D>("Sprites/ufo3")); Textures.Add("exp3", Content.Load<Texture2D>("Sprites/exp3")); //Imagens da nave (ship) Textures.Add("ship", Content.Load<Texture2D>("Sprites/ship")); Textures.Add("shipexp", Content.Load<Texture2D>("Sprites/shipexp")); //Imagens do tiro Textures.Add("shoot1", Content.Load<Texture2D>("Sprites/shoot1")); Textures.Add("shoot2", Content.Load<Texture2D>("Sprites/shoot2")); Fonts.Add("vida", Content.Load<SpriteFont>("vida")); } //Carregando os sons do jogo { SoundEffects.Add("blaster", Content.Load<SoundEffect>("Sounds/blaster")); SoundEffects.Add("blub", Content.Load<SoundEffect>("Sounds/blub")); SoundEffects.Add("explosion", Content.Load<SoundEffect>("Sounds/explosion")); SoundEffects.Add("gameover", Content.Load<SoundEffect>("Sounds/gameover")); SoundEffects.Add("getextra", Content.Load<SoundEffect>("Sounds/getextra")); SoundEffects.Add("ship", Content.Load<SoundEffect>("Sounds/ship")); SoundEffects.Add("skid", Content.Load<SoundEffect>("Sounds/skid")); SoundEffects.Add("tap", Content.Load<SoundEffect>("Sounds/tap")); SoundEffects.Add("ufoshoot", Content.Load<SoundEffect>("Sounds/ufoshoot")); SoundEffects.Add("weaponchange", Content.Load<SoundEffect>("Sounds/weaponchange")); } Background back1 = new Background(this, new Vector2(-000, -000), Textures["back"]); Background back2 = new Background(this, new Vector2(-000, -800), Textures["back"]); GameObjects.Add(back1); GameObjects.Add(back2); ship = new Ship(this, new Vector2((Window.ClientBounds.Width - Textures["ship"].Width / 5) / 2, (Window.ClientBounds.Height - Textures["ship"].Height / 5)), Textures["ship"], SoundEffects["ship"]); GameObjects.Add(ship); Ufo ufo = new Ufo(this, new Vector2(GameHelper.RandomNext(Window.ClientBounds.Width - 70), -70), Textures["ufo1"], velocidade_nivel, 1); GameObjects.Add(ufo); }