示例#1
0
 public GameManager()
 {
     Bricks = new List<Brick>();
     gameAI = AI.getInstance();
     Water = new List<Point>();
     Stone = new List<Point>();
     listOfCoins = new List<Coin>();
     listofLifePack=new List<LifePack>();
     mapsize = 10;
     maxPlayers = 5;
     player = new Player[maxPlayers];
     started = false;
 }
示例#2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            #region text objects initializing
            // creating the title
            title_position = new Vector2(0, 0);
            title_text = "                                                                Black Panther ";
            title_color = Color.Black;

            // scoreboard title
            int title_left = 820;
            score_title_color = Color.Black;
            score_title_position = new Vector2(title_left, 100);
            score_title_text = "Score Board";

            // player details

            player_1_color = Color.Black;
            player_1_position = new Vector2(title_left, 240);
            player_1_text = "";

            player_2_color = Color.Black;
            player_2_position = new Vector2(title_left, 280);
            player_2_text = "";

            player_3_color = Color.Black;
            player_3_position = new Vector2(title_left, 320);
            player_3_text = "";

            player_4_color = Color.Black;
            player_4_position = new Vector2(title_left, 360);
            player_4_text = "";

            #endregion

            #region grid

            blocks = new Block[grid_size, grid_size];
            // creating the block
            for (int i = 0; i < grid_size; i++)
            {
                for (int j = 0; j < grid_size; j++)
                {
                    blocks[i, j] = new Block(new Vector2(i * block_pixel_size, j * block_pixel_size + 30));
                }
            }

            #endregion

            #region event handling
            ai = new AI(blocks, grid_size, player_id);
            ai.listenToMessages(this);

            _timer = new System.Timers.Timer(500);
            _timer.Elapsed += new ElapsedEventHandler(run_game);
            _timer.Enabled = true;

            #endregion
            base.Initialize();
        }
示例#3
0
 private void startGame()
 {
     joinfailed = false;
     started = true;
     gAI = AI.getInstance();
     while (!engine.getGameState()) ;
     gAI.initAI();
 }
示例#4
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>



        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            #region text objects initializing
            // creating the title
            title_position = new Vector2(0, 0);
            title_text     = "                                                                Black Panther ";
            title_color    = Color.Black;

            // scoreboard title
            int title_left = 820;
            score_title_color    = Color.Black;
            score_title_position = new Vector2(title_left, 100);
            score_title_text     = "Score Board";

            // player details

            player_1_color    = Color.Black;
            player_1_position = new Vector2(title_left, 240);
            player_1_text     = "";

            player_2_color    = Color.Black;
            player_2_position = new Vector2(title_left, 280);
            player_2_text     = "";

            player_3_color    = Color.Black;
            player_3_position = new Vector2(title_left, 320);
            player_3_text     = "";

            player_4_color    = Color.Black;
            player_4_position = new Vector2(title_left, 360);
            player_4_text     = "";



            #endregion


            #region grid

            blocks = new Block[grid_size, grid_size];
            // creating the block
            for (int i = 0; i < grid_size; i++)
            {
                for (int j = 0; j < grid_size; j++)
                {
                    blocks[i, j] = new Block(new Vector2(i * block_pixel_size, j * block_pixel_size + 30));
                }
            }

            #endregion

            #region event handling
            ai = new AI(blocks, grid_size, player_id);
            ai.listenToMessages(this);



            _timer          = new System.Timers.Timer(500);
            _timer.Elapsed += new ElapsedEventHandler(run_game);
            _timer.Enabled  = true;

            #endregion
            base.Initialize();
        }