Пример #1
0
        public AlienSquad(Bunkers bunkers, BombFactory bombFactory, LaserFactory laserFactory, Player player, Mothership mothership, ScoreAndLife scoreAndLife, int numRows, int numColums, int screenWidth, int playerHeight, int alienWidth, int alienHeight, int alienSpeed, int spacer, int bombFrequency, int alienPointStart, int alienPointDecrement, int alienSpacerFromTop, int speedIncrease, int bombFrequencyIncrement, int bombFrequencyMin)
        {
            this.bunkers                = bunkers;
            this.bombFactory            = bombFactory;
            this.laserFactory           = laserFactory;
            this.numRows                = numRows;
            this.numColumns             = numColums;
            this.alienWidth             = alienWidth;
            this.alienHeight            = alienHeight;
            this.alienSpeed             = alienSpeed;
            this.spacer                 = spacer;
            this.bombFrequency          = bombFrequency;
            this.alienPointStart        = alienPointStart;
            this.alienPointDecrement    = alienPointDecrement;
            this.alienSpacerFromTop     = alienSpacerFromTop;
            this.player                 = player;
            this.mothership             = mothership;
            this.bombFrequencyIncrement = bombFrequencyIncrement;
            this.bombFrequencyMin       = bombFrequencyMin;
            this.scoreAndLife           = scoreAndLife;

            populateAliens();

            // Set static fields
            Alien.bunkerHeight  = bunkers[0].BoundingBox.Y;
            Alien.playerHeight  = playerHeight;
            Alien.screenWidth   = screenWidth;
            Alien.speedIncrease = speedIncrease;

            laserFactory.nextWave += handleNextWave;
            scoreAndLife.gameOver += KillAll;
        }
Пример #2
0
        public Player(int screenWidth, int screenHeight, int speed, int width, int height, LaserFactory laserFactory, BombFactory bombFactory, ScoreAndLife scoreAndLife, int timerIntervalPlayerRespawn)
        {
            this.screenWidth  = screenWidth;
            this.speed        = speed;
            this.boundingBox  = new Rectangle(screenWidth / 2 - width / 2, screenHeight - height, width, height);
            this.laserFactory = laserFactory;
            this.bombFactory  = bombFactory;
            this.scoreAndLife = scoreAndLife;

            Alive = true;

            timerPlayerRespawn          = new Timer(timerIntervalPlayerRespawn);
            timerPlayerRespawn.Elapsed += playerRespawn;
            bombFactory.playerDeath    += handlePlayerDeath;
        }