Esempio n. 1
0
 public GameState Act(GameState state)
 {
     return(Act(state, () => EnemyFeatures.SpawnIteration == EnemyFeatures.SpawnFrequency, x =>
     {
         x.Add(new Enemy(rightStart, Game, VectorMoves.MoveHalfCircleRight(new Vector(rightStart)),
                         EnemyFeatures.EnemyVelocity, EnemyFeatures.BulletVelocity));
         x.Add(new Enemy(leftStart, Game, VectorMoves.MoveHalfCircleLeft(new Vector(leftStart)),
                         EnemyFeatures.EnemyVelocity, EnemyFeatures.BulletVelocity));
     }, true, shootingDirection));
 }
Esempio n. 2
0
 public GameState Act(GameState state)
 {
     return(base.Act(state, () => EnemyFeatures.SpawnIteration == EnemyFeatures.SpawnFrequency, x =>
     {
         x.Add(new Enemy(leftStart, Game,
                         VectorMoves.EightLeft(new Vector(leftStart)), EnemyFeatures.EnemyVelocity, EnemyFeatures.BulletVelocity));
         x.Add(new Enemy(rightStart, Game,
                         VectorMoves.EightRight(new Vector(rightStart)), EnemyFeatures.EnemyVelocity, EnemyFeatures.BulletVelocity));
     }, true, x => new[] { new ShootingPattern {
                               Direction = Vector.Down
                           } }));
 }
Esempio n. 3
0
 public BossFight(Game game, EnemyFeatures features, Point start, int hp)
 {
     Game               = game;
     EnemyFeatures      = features;
     EnemyFeatures.Boss = new Boss(start, Game, VectorMoves.BossMoves(new Vector(start)),
                                   EnemyFeatures.EnemyVelocity, EnemyFeatures.BulletVelocity)
     {
         HP = hp,
     };
     this.start = start;
     breakLen   = 200;
     phaseCount = 5;
 }
Esempio n. 4
0
 public GameState Act(GameState state)
 {
     return(Act(state, () => needToSpawn, x =>
     {
         for (var i = Game.GameFeatures.FieldSize.Width / (enemyCount + 1);
              i < Game.GameFeatures.FieldSize.Width;
              i += Game.GameFeatures.FieldSize.Width / (enemyCount + 1))
         {
             x.Add(new Enemy(new Point(i, 0), Game,
                             VectorMoves.MoveForBombing(new Vector(i, 0)), EnemyFeatures.EnemyVelocity, EnemyFeatures.BulletVelocity));
         }
         needToSpawn = false;
     }, true, shootingDirection));
 }
Esempio n. 5
0
 public GameState Act(GameState state)
 {
     return(base.Act(state, () => needToSpawn, x =>
     {
         for (var i = Game.GameFeatures.FieldSize.Width / (enemyCount + 1);
              i < Game.GameFeatures.FieldSize.Width;
              i += Game.GameFeatures.FieldSize.Width / (enemyCount + 1))
         {
             x.Add(new Enemy(new Point(i, 0), Game,
                             VectorMoves.MoveForBombing(new Vector(i, 0)), EnemyFeatures.EnemyVelocity, EnemyFeatures.BulletVelocity));
         }
         needToSpawn = false;
     }, true, x => directions.Select(z => new ShootingPattern {
         Direction = z
     }).ToArray()));
 }
Esempio n. 6
0
        public Dialog(Game game, DialogInfo info, string[] playerPhrases, string[] bossPhrases)
        {
            Game = game;
            var count = 0;

            boss = new Boss(info.BossSpawnPoint, game, VectorMoves.MoveToTarget(new Vector(info.BossSpawnPoint),
                                                                                new Vector(info.BossStartPoint)), 1, 1, true)
            {
                Name = info.BossName,
                HP   = 10
            };
            Phrases = new Queue <Tuple <ICharacter, string, string> >(playerPhrases
                                                                      .Zip(bossPhrases, (x, y) => x + "\r" + y)
                                                                      .SelectMany(x => x.Split('\r'))
                                                                      .ToList()
                                                                      .Select(x => Tuple.Create(
                                                                                  ++count % 2 == 0 ? (ICharacter)boss : (ICharacter)game.Player,
                                                                                  count % 2 == 0 ? boss.Name : game.Player.Name, x)));
            phraseLifetime = 200;
            EnemyFeatures  = new EnemyFeatures
            {
                Lifetime = Phrases.Count * phraseLifetime
            };
        }
Esempio n. 7
0
        public Func <Enemy, ShootingPattern[]> GenerateShootingDirections()
        {
            if (isBreak)
            {
                return(x => new ShootingPattern[0]);
            }
            var randomPicture = rnd.Next(2, 6);
            var picture       = $"boss-bullet-{randomPicture}.png";

            switch (phase)
            {
            case 0:     //
                var random = rnd.Next(0, 2);
                if (random == 1)
                {
                    return(x => Directions.GetAroundVectors(16).Skip(16).Take(8)
                           .Select(z => new ShootingPattern
                    {
                        Direction = z,
                        BulletImage = picture
                    }).ToArray());
                }
                else
                {
                    return(x => Directions.GetAroundVectors(16).Skip(8).Take(8)
                           .Select(z => new ShootingPattern
                    {
                        Direction = z,
                        BulletImage = picture
                    }).ToArray());
                }

            case 1:
                return(x => Directions.GetAroundVectors(16)
                       .Select(z => new ShootingPattern
                {
                    Direction = z,
                    BulletImage = picture
                }).ToArray());

            case 2:
                return(x => new[] {
                    (Game.Player.Location - x.Location).Rotate(Math.PI / 20),
                    Game.Player.Location - x.Location,
                    (Game.Player.Location - x.Location).Rotate(-Math.PI / 20)
                }
                       .Select(z => new ShootingPattern
                {
                    Direction = z,
                    BulletImage = picture
                }).ToArray());

            case 3:
                return(x => Directions.GetAroundVectors(16)
                       .Select(z => new ShootingPattern
                {
                    Pattern = VectorMoves.FlyAndFall(x.Location, z),
                    Direction = Vector.Zero,
                    BulletImage = picture
                }).ToArray());

            case 4:
                return(x => Directions.GetAroundVectors(5)
                       .Select(z => new ShootingPattern
                {
                    Pattern = VectorMoves.FlyAndToTarget(x.Location, z, Game.Player.Location - x.Location),
                    Direction = Vector.Zero,
                    BulletImage = picture
                }).ToArray());

            default:
                return(x => Directions.GetRow(10, x.Location.Y)
                       .Select(z => new ShootingPattern
                {
                    Pattern = new VectorMove(z, 10, Game.Player.Location - x.Location),
                    Direction = Vector.Zero,
                    BulletImage = "boss-bullet-1.png"
                }).ToArray());
            }
        }