コード例 #1
0
        /// <summary>
        /// Update the gameplay logic.
        /// </summary>
        /// <param name="deltaTime"></param>
        private void UpdateGameplay(float deltaTime)
        {
            Player.Update(deltaTime);
            EnemyGroup.Update(deltaTime);
            ProjectileController.Update(deltaTime);
            UfoController.Update(deltaTime);

            if (EnemyGroup.RemainingEnemyCount > 0)
            {
                return;
            }

            EnemyGroup.Spawn();
            Player.Lives += 1;
        }
コード例 #2
0
        /// <summary>
        /// Render the gameplay screen.
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Draw(GameTime gameTime)
        {
            spriteBatch.DrawLine(HorizontalBoundaryStart, HorizontalBoundaryEnd, ColourHelpers.PureGreen, 2);

            if (!isGameover)
            {
                EnemyGroup.Draw(spriteBatch);
                UfoController.Draw(spriteBatch);
                ProjectileController.Draw(spriteBatch);
            }

            Player.Draw(spriteBatch);
            BarrierGroup.Draw(spriteBatch);

            DrawUI();
            DrawGameoverUI();
        }
コード例 #3
0
        /// <summary>
        /// Load the content for this gameplay screen.
        /// </summary>
        /// <param name="spriteBatch"></param>
        public override void LoadContent(SpriteBatch spriteBatch)
        {
            this.spriteBatch = spriteBatch;

            // Load fonts
            hudSpriteFont    = MainGame.Context.Content.Load <SpriteFont>("SpaceInvadersFont");
            headerSpriteFont = MainGame.Context.Content.Load <SpriteFont>("SpaceInvadersFontHeader");

            // Load all the enemy types
            EnemyType.Load(MainGame.Context.Content);

            Player       = new Player();
            BarrierGroup = new BarrierGroup();
            Player.InitializeHorizontalPosition();

            EnemyGroup           = new EnemyGroup();
            ProjectileController = new ProjectileController();
            UfoController        = new UfoController();
        }
コード例 #4
0
 public ProjectileCollisionController(ProjectileController c)
 {
     this.con = c;
 }
コード例 #5
0
 public virtual void acceptProjectileController(ProjectileController projectileController)
 {
 }
コード例 #6
0
 public void setProjectileController(ProjectileController projectileController)
 {
     this.projectileController = projectileController;
 }
コード例 #7
0
        public override void Load()
        {
            Receiver.instance.clearTime();
            if (isLoaded == false)
            {
                resetCommand = new PlayGameResetCommand();
                explosion    = RealSpriteFactory.getSprite(SpriteType.Explosion);
                CollisionSubjectFactory.getFactory.getAlienVictorySubject().setPos(800, 100);
                CollisionSubjectFactory.getFactory.getAlienVictorySubject().setScale(100, 30);
                ufoController = UFOSpawnControllerFactory.getFactory.getController;
                isLoaded      = true;
                it            = CollisionControllerFactory.getFactor.getIterator;

                shieldList = ShieldListFactory.getFactory.getShieldList();
                //collisionBox = new Azul.SpriteBox(new Azul.Rect(1,1,1,1), new Azul.Color(1.0f, 1.0f, 1.0f, 1.0f));
                Azul.Texture f = new Azul.Texture("Font.tga");

                GameObjectTreeFactory.getFactory.getUfo().setPos(100, 100);
                GameObjectTreeFactory.getFactory.getUfo().setStatus(Status.Active);

                m = AnimationManagerList.instance.findManager(SpriteType.Crab);
                //letterManager = LetterManagerFactory.getFactory().createManager("HELLO BOYS");
                //letterManager.setPos(100, 100);

                //---------------------------------------------------------------------------------------------------------
                // Load the Textures
                //---------------------------------------------------------------------------------------------------------


                movement = MovementControllerFactory.getFactory.getController();

                /*colObserver = new MovementCollisionObserver(movement);
                 * colSubject = new AlienGridCollisionSubject(GameObjectTreeFactory.getFactory.alien, SpriteType.Unitialized);
                 * colSubject.addObserver(new MovementCollisionObserver(movement));*/
                //colSubject = CollisionSubjectFactory.getFactory.getAlienSubject();
                //colSubject.addCollisionTest(collisionTest);
                wallList = GridWallCollisionListFactory.getFactory().getList();
                player   = PlayerFactory.instance.getPlayer();

                //player.setSpriteScale(100, 100);
                inputController = PlayerInputControllerFactory.getFactory.getController();



                projectileController = ProjectileControllerFactory.instance.controller;
                controller           = CommandProjectileFactory.getFactory.controller;
                score = ScoreFactory.getFactory.player_1;
                //score.setPos(100, 100);
                //ScoreFactory.getFactory.player_2.setPos(400,100);
                //ScoreFactory.getFactory.high_score.setPos(300, 900);
                score.addScore(0);
                score.setImages();
                explosion.setPosition(300, 100);
            }
            if (start == false)
            {
                movement.setMovementDirection(MovementStateFactory.right);
                PlayerStatusControllerFactory.getFactory.getController.setAllPos(100, 600);
                PlayerStatusControllerFactory.getFactory.getController.setAllLives(3);
                ScoreFactory.getFactory.player_1.setScore(0);
                ScoreFactory.getFactory.player_2.setScore(0);
                ScoreFactory.getFactory.player_1.setImages();
                PlayScoreControllerFactory.getFactory.playController.setPlayerScoreController(ScoreFactory.getFactory.player_1);
                ScoreFactory.getFactory.player_2.setImages();
                //ufoController.getUfo().setStatus(Status);
                start = true;
            }
            CollisionSpawnFactory.getFactory.setAllInactive();
            setAllActive();
            resetPosition();
            addToRecevier();

            /*ufoController.addToReceiver();
             * movement.addCommandToReceiver();
             *
             * Scale sh = SizeFactory.getFactory.shieldScale;
             * GameObjectTreeFactory.getFactory.alien.setPos(100, 600, SizeFactory.getFactory.alienScale.spriteWidth, SizeFactory.getFactory.alienScale.spriteHeight);
             * movement.setActive(Status.Active);
             * movement.setAllActive(Status.Active);
             * shieldList.setAllActive(Status.Active);
             * shieldList.setPos(100, 200, sh.colWidth, sh.colHeight, 0);
             * shieldList.setPos(300, 200, sh.colWidth, sh.colHeight, 1);
             * shieldList.setPos(500, 200, sh.colWidth, sh.colHeight, 2);
             * shieldList.setPos(700, 200, sh.colWidth, sh.colHeight, 3);
             * player.setPos(100, 100);
             * controller.addToReceiver();
             * player.setStatus(Status.Active);*/
            projectileController.deactiateProjectiles();
        }
コード例 #8
0
 public ProjectileControllerFactory()
 {
     projectileController = new ProjectileController(playerProjectile, enemyProjectile);
 }