public Plane(Coordinates topLeft, int difficulty) : base(topLeft, new char[,] { { '<' } }, new Coordinates(0, -1)) { this.HasToDropBombs = false; this.difficulty = difficulty; this.bombRand = new Random(); }
public PlaneProducer(Coordinates worldEnd, int difficulty) { this.ScoreMultiplier = 1; this.worldEnd = worldEnd; this.difficulty = difficulty; CalculateChances(); }
public override IEnumerable<GameObject> ProduceObjects() { List<GameObject> produced = new List<GameObject>(); if (this.HasToShoot) { Coordinates missileCoordinates1 = new Coordinates(this.topLeft.Row - 1, this.topLeft.Colum); Coordinates missileCoordinates2 = new Coordinates(this.topLeft.Row - 1, this.topLeft.Colum + 1); Coordinates missileCoordinates3 = new Coordinates(this.topLeft.Row - 1, this.topLeft.Colum - 1); if( this.shootingLevel == 1 ) produced.Add(new Missile(missileCoordinates1)); if (this.shootingLevel == 2) { produced.Add(new Missile(missileCoordinates2)); produced.Add(new Missile(missileCoordinates3)); } if (this.shootingLevel > 2) { produced.Add(new Missile(missileCoordinates1)); produced.Add(new Missile(missileCoordinates2)); produced.Add(new Missile(missileCoordinates3)); } } this.HasToShoot = false; return produced; }
public override IEnumerable<GameObject> ProduceObjects() { List<GameObject> produced = new List<GameObject>(); if (HasToDropBombs) { HasToDropBombs = false; Coordinates bombCoords = new Coordinates(this.topLeft.Row + 1, this.topLeft.Colum); produced.Add(new Bomb(bombCoords)); } return produced; }
static void Main() { int worldRows = Coordinates.worldRows; int worldColums = Coordinates.worldColums; Coordinates endOfWorld = new Coordinates(worldRows, worldColums); IUserInterface userInterface = new KeyboardUserInterface(); ICollisionDispatcher collisionDispatcher = new CollisionDispatcher(); IRenderer renderer = new ConsoleRenderer(worldRows, worldColums); Tank theTank = new Tank(new Coordinates(worldRows - 1, worldColums / 2)); IEnemyFactory enemy = new PlaneProducer(endOfWorld, 8); Engine gameEngine = new Engine(userInterface, collisionDispatcher, renderer, theTank, enemy, 100); gameEngine.Run(); }
public IEnumerable<GameObject> ProduceObjects() { List<GameObject> produced = new List<GameObject>(); int firstRowRandom = planeRand.Next(0, 100); int secondRowRandom = planeRand.Next(0, 100); int thirdRowRandom = planeRand.Next(0, 100); int giftPlaneRandom; Coordinates firstRow = new Coordinates(0, worldEnd.Colum - 1); Coordinates secondRow = new Coordinates(1, worldEnd.Colum - 1); Coordinates thirdRow = new Coordinates(2, worldEnd.Colum - 1); if (firstRowRandom <= firstRowChance) { giftPlaneRandom = planeRand.Next(0, 100); if (giftPlaneRandom < giftPlaneChance) produced.Add(new GiftPlane(firstRow, 1)); else produced.Add(new Plane(firstRow, 1)); } if (secondRowRandom <= secondRowChance) { giftPlaneRandom = planeRand.Next(0, 100); if (giftPlaneRandom < giftPlaneChance) produced.Add(new GiftPlane(secondRow, 1)); else produced.Add(new Plane(secondRow, 1)); } if (thirdRowRandom <= thirdRowChance) { giftPlaneRandom = planeRand.Next(0, 100); if (giftPlaneRandom < giftPlaneChance) produced.Add(new GiftPlane(thirdRow, 1)); else produced.Add(new Plane(thirdRow, 1)); } return produced; }
public GameObject(Coordinates topLeft, char[,] body) { this.topLeft = topLeft; this.body = body; this.IsDestroyed = false; }
public void MoveTankRight() { Coordinates newTankCoords = new Coordinates(theTank.topLeft.Row, theTank.topLeft.Colum + 1); if( newTankCoords.IsInRange() ) this.theTank.topLeft.Colum++; }
public Missile(Coordinates topLeft) : base(topLeft, new char[,] { { '|' } }, new Coordinates(-1, 0)) { }
public Gift(Coordinates topLeft) : base(topLeft, new char[,] { { '+' } }, new Coordinates(1, 0)) { }
public MovingObject(Coordinates topLeft, char[,] body, Coordinates speed) : base(topLeft, body) { this.speed = speed; }
public Tank(Coordinates topLeft) : base(topLeft, new char[,] { { '^' } }) { shootingLevel = 1; }
public Bomb(Coordinates topLeft) : base(topLeft, new char[,] { { '@' } }, new Coordinates(1, 0)) { }
public GiftPlane(Coordinates topLeft, int difficulty) : base(topLeft, difficulty) { this.dropGift = false; this.body = new char[,] { { '«' } }; }