Exemplo n.º 1
0
        private List<Wall> worldWalls; //list that contains all active walls

        #endregion Fields

        #region Constructors

        //<----- CONSTRUCTOR !!!!!!!
        public Engine(int fieldWidth, int fieldHeight)
        {
            Console.CursorVisible = false;
            Console.SetWindowSize(fieldWidth + 5, fieldHeight + 5);
            this.Stats = new PlayerStats();
            FieldHeight   = fieldHeight;
            FieldWidth    = fieldWidth;
            dead          = false;                         // player dead?
            nextWall      = 0;                             // if == 0 add wall, else set value depending on timeElasped
            wallPosition  = false;
            timeElapsed   = 1;
            worldWalls    = new List<Wall>();
            worldFood     = new List<Food>();
            worldBullets = new List<Bullet>();      // Game Bullets
            worldProjectiles = new List<Projectile>();
            Ship          = new Ship(new Point(5, FieldHeight / 2));
            this.Ship.HasAbility = false;
            bwReadKey     = new BackgroundWorker();        // initialize the background worker to read keys from the console
            bwUpdateField = new BackgroundWorker();
            gameTimer = new System.Timers.Timer();
            abilityTimer = new System.Timers.Timer();
            gameTimer.Interval = 1000;
            gameTimer.Elapsed += gameTimer_Elapsed;
            GameSleep = 500;
            gameTimer.Start();
            RunBgWorkers();
        }
Exemplo n.º 2
0
 public BaseShip(Ship ship) : base(ship)
 {
 }