示例#1
0
 public Enemy(Coordinates coordinates, long spawnTime)
 {
     SpawnTime             = spawnTime;
     _myInitialCoordinates = coordinates;
     _coordinates          = coordinates;
     _oldCoordinates       = coordinates;
     _oldCoordinates.SetDisplacements(0, -1);
     _relativeBoundry = new Coordinates(Designs.GetEnemy().Length - 1, 0);
 }
        /// <summary>
        /// Creates an istance of an enemy line within the board and its appropriate stats.
        /// </summary>
        /// <param name="spawnTime"></param>
        public EnemyLine(long spawnTime)
        {
            SpawTime = spawnTime;

            for (int i = 0; i < DisplayParameters.NumberEnemiesLine; i++)
            {
                Coordinates coordinates = DisplayParameters.FirstEnemy;
                _enemies.Add(new Enemy(coordinates.SetDisplacements((Designs.GetEnemy().Length + 1) * i, 1), spawnTime));
            }
        }
示例#3
0
 /// <summary>
 /// Calculates the positions for all static fileds on the console and all initial positions of the moveing ones.
 /// </summary>
 public static void Calculate()
 {
     Score               = new Coordinates(5, 3);
     Lives               = new Coordinates(ConsoleParameters.Width / 2 - 5, 3);
     Fps                 = new Coordinates(ConsoleParameters.Width - 16, 3);
     ScoreBoardLine      = new Coordinates(0, 5);
     HeroSpaceLine       = new Coordinates(0, ConsoleParameters.Height - 7);
     HeroInitial         = new Coordinates(ConsoleParameters.Width / 2 - 2, ConsoleParameters.Height - 5);
     FirstEnemy          = new Coordinates(5, 6);
     NumberEnemiesLine   = (int)((ConsoleParameters.Width - 10) / (Designs.GetEnemy().Length + 1));
     EnemyMovementsPermS = 0.0002;
 }
示例#4
0
 public void ForceDisplay()
 {
     for (int i = 0; i <= _relativeBoundry.Y; i++)
     {
         if (Designs.GetEnemy().Length + _coordinates.X > ConsoleParameters.Width - 5)
         {
             throw new ArgumentOutOfRangeException($" {nameof(Enemy)} is placed too close to boudry.");
         }
         ;
         Console.SetCursorPosition(_coordinates.X, _coordinates.Y + i);
         Console.Write(Designs.GetEnemy());
     }
 }