protected override void upgrade(Player player) { Bomb b = new Bomb(map, player, "Images/bomb1"); b.Initialize(); b.LoadContent(); player.AddBomb(b); }
private void createComponent(char c, int x, int y) { // digit means - it is a place for player if (char.IsDigit(c)) { // in the map file, there can be more digits (reserved for players) but we do not use all of them int index = c - '0'; if (index < ActivePlayers) // only add player if it is allowed players[index] = new Player(this, x, y, "Images/player" + index.ToString(), index); } else { MapObject comp = null; switch (c) { // create stone case 's': comp = new Stone(this, x, y, "Images/stone2"); break; // '.' means free space - some barrel may be created case '.': if (generator.Next(0, 10) < 3) return; // do not create barrel on each position int rnd = generator.Next(0, 7); BonusType type = BonusType.None; if (rnd < 4) // only 4 of 7 barrel have some bonus type = (BonusType)rnd; comp = new Barrel(this, x, y, "Images/box2", type); break; } if (comp != null) // just create an instace of this component, but do not load components[x, y] = comp; } }
public void PlayerKilled(Player player, GameTime gameTime) { ActivePlayers--; //(Game as Game1).PlayerKilled(i); if (ActivePlayers <= 1) // only one player is living - game finished Destroy(gameTime); }
protected override void upgrade(Player player) { player.AddSpeed(0.02f); }
protected override void upgrade(Player player) { player.AddFire(length); }
public Bomb(Map map, Player owner, int x, int y, string textureFile) : base(map, x, y, textureFile) { this.owner = owner; }
public Bomb(Map map, Player owner, int x, int y) : base(map, x, y) { this.owner = owner; }
/// <summary> /// When player enter bonus position, he is upgreaded by it. This could be: get a new bomb, /// improve the fire, speed, ... /// </summary> /// <param name="player">Instance of player to updrade</param> protected abstract void upgrade(Player player);