コード例 #1
0
        public Player(
            ICastle castle,
            IHealthInvoker healthInvoker,
            IImageManager imageManager,
            IMovementDirectionManager movementDirectionManager,
            IMovementStrategyInvoker movementStrategyInvoker,
            IAllWeaponsFactory weaponsFactory
            )
        {
            _castle                   = castle;
            _healthInvoker            = healthInvoker;
            _imageManager             = imageManager;
            _movementDirectionManager = movementDirectionManager;
            _movementStrategyInvoker  = movementStrategyInvoker;
            _weaponsFactory           = weaponsFactory;

            behaviorType = BehaviorTypeEnum.Targeted;

            AllSwordSwingImages         = new List <System.Windows.Controls.Image>();
            AllMaceSwingImages          = new List <System.Windows.Controls.Image>();
            AllArrowShootingLeftImages  = new List <System.Windows.Controls.Image>();
            AllArrowShootingRightImages = new List <System.Windows.Controls.Image>();
            weaponsCarried_Observers    = new List <IWeapon>();
            allEnemies_Observers        = new List <IEnemy>();
            allTargets = new List <ITarget>();

            ShootingDirection_Player = Key.None;
            _speedMovement           = 5;
        }
コード例 #2
0
        public override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Blue);

            ICastle castle = (ICastle)Game.Services.GetService(typeof(ICastle));

            spriteBatch.Begin();
            switch (castle.StoryStage)
            {
            case 1:
            {
                spriteBatch.Draw(storyImage, new Rectangle(0, 0, Game.GraphicsDevice.PresentationParameters.BackBufferWidth, Game.GraphicsDevice.PresentationParameters.BackBufferHeight), Color.White);
                break;
            }

            case 2:
            {
                spriteBatch.Draw(story2Image, new Rectangle(0, 0, Game.GraphicsDevice.PresentationParameters.BackBufferWidth, Game.GraphicsDevice.PresentationParameters.BackBufferHeight), Color.White);
                break;
            }
            }
            spriteBatch.End();

            base.Draw(gameTime);
        }
コード例 #3
0
        public void should_create_elven_castle()
        {
            IKingdomFactory kingdomFactory = FactoryMaker.Create(KingdomType.ELF);

            ICastle castle = kingdomFactory.CreateCastle();

            Assert.Equal("This is Elven castle", castle.Description);
        }
コード例 #4
0
        public void should_create_orc_castle()
        {
            IKingdomFactory kingdomFactory = FactoryMaker.Create(KingdomType.ORC);

            ICastle castle = kingdomFactory.CreateCastle();

            Assert.Equal("This is Orc castle", castle.Description);
        }
コード例 #5
0
 public GameDashboard(
     IAllEnemiesFactory allEnemiesFactory,
     IAllEnemyWeaponsFactory allEnemyWeaponsFactory,
     ICastle castle, IGameLevelInvoker gameLevelInvoker,
     IImageManager imageManager,
     IPlayer player,
     IUIMediator uiMediator)
 {
     _allEnemiesFactory      = allEnemiesFactory;
     _allEnemyWeaponsFactory = allEnemyWeaponsFactory;
     _castle           = castle;
     _gameLevelInvoker = gameLevelInvoker;
     _imageManager     = imageManager;
     _player           = player;
     _uiMediator       = uiMediator;
 }
コード例 #6
0
        public Bat(
            IBehaviorInvoker behaviorInvoker,
            ICastle castle,
            IHealthInvoker healthInvoker,
            IImageManager imageManager,
            IMovementDirectionManager movementDirectionManager,
            IMovementStrategyInvoker movementStrategyInvoker
            )
        {
            _behaviorInvoker          = behaviorInvoker;
            _castle                   = castle;
            _healthInvoker            = healthInvoker;
            _imageManager             = imageManager;
            _movementDirectionManager = movementDirectionManager;
            _movementStrategyInvoker  = movementStrategyInvoker;

            EnemyName      = EnemyNameEnum.Bat;
            _speedMovement = 8;
            _strikePoints  = 5;
            SetBehaviorType(BehaviorTypeEnum.Random);
            MovementDirection = movementDirectionManager.GetRandomDirection();
        }
コード例 #7
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            engine.Update();

            castle = (ICastle)Game.Services.GetService(typeof(ICastle));
            player = (IPlayer)Game.Services.GetService(typeof(IPlayer));
            // TODO: Add your update code here

            SpawnEnemy(gameTime);
            ApplyAlignments();
            MoveEnemies(gameTime);

            ICamera camera = (ICamera)Game.Services.GetService(typeof(ICamera));

            killEnemyParticles.SetCamera(camera.ViewMatrix, camera.ProjectionMatrix);
            bloodParticles.SetCamera(camera.ViewMatrix, camera.ProjectionMatrix);
            ghostParticles.SetCamera(camera.ViewMatrix, camera.ProjectionMatrix);
            poisonEnemyParticles.SetCamera(camera.ViewMatrix, camera.ProjectionMatrix);

            // Add particles
            foreach (Enemy e in enemies)
            {
                if (e.IsDOT)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        poisonEnemyParticles.AddParticle(new Vector3(e.PositionX * 0.008f, e.PositionY * 0.008f + 2, e.PositionZ * 0.008f + 2), Vector3.Zero);
                    }
                }

                switch (e.ParticleSystemId)
                {
                    case 0:
                    {
                        for (int i = 0; i < 2; i++)
                        {
                            poisonEnemyParticles.AddParticle(new Vector3(e.PositionX * 0.008f, e.PositionY * 0.008f + 2, e.PositionZ * 0.008f + 2), Vector3.Zero);
                        }
                        break;
                    }
                    case 1:
                    {
                        for (int i = 0; i < 1; i++)
                        {
                            ghostParticles.AddParticle(new Vector3(e.PositionX * 0.008f, e.PositionY * 0.008f + 1, e.PositionZ * 0.008f), Vector3.Zero);
                        }
                        break;
                    }
                    default:
                    {
                        // None
                        break;
                    }
                }
            }

            killEnemyParticles.Update(gameTime);
            bloodParticles.Update(gameTime);
            ghostParticles.Update(gameTime);
            poisonEnemyParticles.Update(gameTime);

            base.Update(gameTime);
        }
コード例 #8
0
 private void setCastle(ICastle castle) => this.castle = castle;
コード例 #9
0
 public void createKingdom(IKingdomFactory factory)
 {
     king   = factory.createKing();
     castle = factory.createCastle();
     army   = factory.createArmy();
 }
コード例 #10
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            engine.Update();

            castle = (ICastle)Game.Services.GetService(typeof(ICastle));
            player = (IPlayer)Game.Services.GetService(typeof(IPlayer));
            // TODO: Add your update code here

            SpawnEnemy(gameTime);
            ApplyAlignments();
            MoveEnemies(gameTime);


            ICamera camera = (ICamera)Game.Services.GetService(typeof(ICamera));

            killEnemyParticles.SetCamera(camera.ViewMatrix, camera.ProjectionMatrix);
            bloodParticles.SetCamera(camera.ViewMatrix, camera.ProjectionMatrix);
            ghostParticles.SetCamera(camera.ViewMatrix, camera.ProjectionMatrix);
            poisonEnemyParticles.SetCamera(camera.ViewMatrix, camera.ProjectionMatrix);

            // Add particles
            foreach (Enemy e in enemies)
            {
                if (e.IsDOT)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        poisonEnemyParticles.AddParticle(new Vector3(e.PositionX * 0.008f, e.PositionY * 0.008f + 2, e.PositionZ * 0.008f + 2), Vector3.Zero);
                    }
                }

                switch (e.ParticleSystemId)
                {
                case 0:
                {
                    for (int i = 0; i < 2; i++)
                    {
                        poisonEnemyParticles.AddParticle(new Vector3(e.PositionX * 0.008f, e.PositionY * 0.008f + 2, e.PositionZ * 0.008f + 2), Vector3.Zero);
                    }
                    break;
                }

                case 1:
                {
                    for (int i = 0; i < 1; i++)
                    {
                        ghostParticles.AddParticle(new Vector3(e.PositionX * 0.008f, e.PositionY * 0.008f + 1, e.PositionZ * 0.008f), Vector3.Zero);
                    }
                    break;
                }

                default:
                {
                    // None
                    break;
                }
                }
            }

            killEnemyParticles.Update(gameTime);
            bloodParticles.Update(gameTime);
            ghostParticles.Update(gameTime);
            poisonEnemyParticles.Update(gameTime);

            base.Update(gameTime);
        }