예제 #1
0
 public Plane(Coordinates topLeft, int difficulty)
     : base(topLeft, new char[,] { { '<' } }, new Coordinates(0, -1))
 {
     this.HasToDropBombs = false;
     this.difficulty = difficulty;
     this.bombRand = new Random();
 }
예제 #2
0
 public PlaneProducer(Coordinates worldEnd, int difficulty)
 {
     this.ScoreMultiplier = 1;
     this.worldEnd = worldEnd;
     this.difficulty = difficulty;
     CalculateChances();
 }
예제 #3
0
        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;
        }
예제 #4
0
        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;
        }
예제 #5
0
        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();
        }
예제 #6
0
        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;
        }
예제 #7
0
 public GameObject(Coordinates topLeft, char[,] body)
 {
     this.topLeft = topLeft;
     this.body = body;
     this.IsDestroyed = false;
 }
예제 #8
0
 public void MoveTankRight()
 {
     Coordinates newTankCoords = new Coordinates(theTank.topLeft.Row, theTank.topLeft.Colum + 1);
     if( newTankCoords.IsInRange() ) this.theTank.topLeft.Colum++;
 }
예제 #9
0
 public Missile(Coordinates topLeft)
     : base(topLeft, new char[,] { { '|' } }, new Coordinates(-1, 0))
 {
 }
예제 #10
0
 public Gift(Coordinates topLeft)
     : base(topLeft, new char[,] { { '+' } }, new Coordinates(1, 0))
 {
 }
예제 #11
0
 public MovingObject(Coordinates topLeft, char[,] body, Coordinates speed)
     : base(topLeft, body)
 {
     this.speed = speed;
 }
예제 #12
0
 public Tank(Coordinates topLeft)
     : base(topLeft, new char[,] { { '^' } })
 {
     shootingLevel = 1;
 }
예제 #13
0
 public Bomb(Coordinates topLeft)
     : base(topLeft, new char[,] { { '@' } }, new Coordinates(1, 0))
 {
 }
예제 #14
0
 public GiftPlane(Coordinates topLeft, int difficulty)
     : base(topLeft, difficulty)
 {
     this.dropGift = false;
     this.body = new char[,] { { '«' } };
 }