示例#1
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
            this.IsMouseVisible = true;
            Font1 = Content.Load <SpriteFont>("SpriteFont1");
            // Create Scenario
            this.testScenario = new ZRTSModel.Scenario.Scenario(20, 20);


            // The most challenging obstacles
            //createTestGameWorld();

            // Empty Map
            //createEmptyTestGameWorld();

            // Simulating gameplay
            createTestGameWorldSimulateBuildings();

            // Controller
            this.testGameController = new ZRTSLogic.Controller(this.testScenario);

            // Dummy unit
            //this.testScenario.getGameWorld().getUnits().Add(new ZRTSModel.Entities.Unit(0, 20, 100, 50, 0));
            /** NOTE: Adding Entities should be done through the Controller from now on **/
            this.testGameController.addUnit(new ZRTSModel.Entities.Unit(testGameController.scenario.getWorldPlayer(), 20, 100, 50, 0), 5, 10);
            this.testGameController.addUnit(new ZRTSModel.Entities.Unit(testGameController.scenario.getWorldPlayer(), 20, 100, 50, 0), 10, 5);

            input     = new MouseState();
            prevInput = input;
            base.Initialize();
        }
        /// <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
            this.IsMouseVisible = true;
            Font1 = Content.Load<SpriteFont>("SpriteFont1");
            // Create Scenario
            this.testScenario = new ZRTSModel.Scenario.Scenario(20, 20);

            // The most challenging obstacles
            //createTestGameWorld();

            // Empty Map
            //createEmptyTestGameWorld();

            // Simulating gameplay
            createTestGameWorldSimulateBuildings();

            // Controller
            this.testGameController = new ZRTSLogic.Controller(this.testScenario);

            // Dummy unit
            //this.testScenario.getGameWorld().getUnits().Add(new ZRTSModel.Entities.Unit(0, 20, 100, 50, 0));
            /** NOTE: Adding Entities should be done through the Controller from now on **/
            this.testGameController.addUnit(new ZRTSModel.Entities.Unit(testGameController.scenario.getWorldPlayer(), 20, 100, 50, 0), 5, 10);
            this.testGameController.addUnit(new ZRTSModel.Entities.Unit(testGameController.scenario.getWorldPlayer(), 20, 100, 50, 0), 10, 5);
            this.testGameController.addUnit(new ZRTSModel.Entities.Unit(testGameController.scenario.getWorldPlayer(), 20, 100, 50, 0), 15, 10);

            input = new MouseState();
            prevInput = input;
            gameSelectView = new ViewSelect();
            base.Initialize();
        }
示例#3
0
        /// <summary>
        /// Loading game scenario object for process
        /// </summary>
        /// <param name="scene"></param>
        public void LoadScenario(ZRTSModel.Scenario.Scenario scene)
        {
            // Need not to load this scenario into View
            // Basically just return a command corresponding to the clicked icon
            // i.e. click at attack icon, will return attack command and then process the game logic in the gameloop inside ZRTS update();



            this.scenario = scene;
        }
        private void initialize()
        {
            // Initialize game world
            testScenario = new ZRTSModel.Scenario.Scenario(20, 20);


            for (int row = 0; row < this.testScenario.getGameWorld().map.height; ++row)
            {
                for (int col = 0; col < this.testScenario.getGameWorld().map.width; ++col)
                {
                    this.testScenario.getGameWorld().map.getCell(col, row).isValid = true;
                }
            }

            this.testScenario.getGameWorld().map.getCell(9, 9).isValid   = false;
            this.testScenario.getGameWorld().map.getCell(9, 10).isValid  = false;
            this.testScenario.getGameWorld().map.getCell(9, 11).isValid  = false;
            this.testScenario.getGameWorld().map.getCell(10, 9).isValid  = false;
            this.testScenario.getGameWorld().map.getCell(10, 10).isValid = false;
            this.testScenario.getGameWorld().map.getCell(10, 11).isValid = false;
            this.testScenario.getGameWorld().map.getCell(11, 9).isValid  = false;
            this.testScenario.getGameWorld().map.getCell(11, 10).isValid = false;


            this.testScenario.getGameWorld().map.getCell(14, 4).isValid = false;
            this.testScenario.getGameWorld().map.getCell(14, 5).isValid = false;
            this.testScenario.getGameWorld().map.getCell(14, 6).isValid = false;
            this.testScenario.getGameWorld().map.getCell(15, 4).isValid = false;
            this.testScenario.getGameWorld().map.getCell(15, 5).isValid = false;
            this.testScenario.getGameWorld().map.getCell(15, 6).isValid = false;
            this.testScenario.getGameWorld().map.getCell(16, 4).isValid = false;
            this.testScenario.getGameWorld().map.getCell(16, 5).isValid = false;

            this.testScenario.getGameWorld().map.getCell(4, 4).isValid = false;
            this.testScenario.getGameWorld().map.getCell(4, 5).isValid = false;
            this.testScenario.getGameWorld().map.getCell(4, 6).isValid = false;
            this.testScenario.getGameWorld().map.getCell(5, 4).isValid = false;
            this.testScenario.getGameWorld().map.getCell(5, 5).isValid = false;
            this.testScenario.getGameWorld().map.getCell(5, 6).isValid = false;
            this.testScenario.getGameWorld().map.getCell(6, 4).isValid = false;
            this.testScenario.getGameWorld().map.getCell(6, 5).isValid = false;

            ///Set controller
            testGameController = new ZRTSLogic.Controller(testScenario);

            ///Add a unit at (17, 17)
            this.testGameController.addUnit(new ZRTSModel.Entities.Unit(testGameController.scenario.getWorldPlayer(), 20), 17, 17);

            ///Initialize Player's resources
            this.testScenario.getPlayer().player_resources[0] = 300;
            this.testScenario.getPlayer().player_resources[1] = 300;
            this.testScenario.getPlayer().player_resources[2] = 300;
            this.testScenario.getPlayer().player_resources[3] = 300;
        }
        private void initialize()
        {
            // Initialize game world
            testScenario = new ZRTSModel.Scenario.Scenario(20,20);

            for (int row = 0; row < this.testScenario.getGameWorld().map.height; ++row)
            {
                for (int col = 0; col < this.testScenario.getGameWorld().map.width; ++col)
                {
                    this.testScenario.getGameWorld().map.getCell(col, row).isValid = true;

                }
            }

            this.testScenario.getGameWorld().map.getCell(9, 9).isValid = false;
            this.testScenario.getGameWorld().map.getCell(9, 10).isValid = false;
            this.testScenario.getGameWorld().map.getCell(9, 11).isValid = false;
            this.testScenario.getGameWorld().map.getCell(10, 9).isValid = false;
            this.testScenario.getGameWorld().map.getCell(10, 10).isValid = false;
            this.testScenario.getGameWorld().map.getCell(10, 11).isValid = false;
            this.testScenario.getGameWorld().map.getCell(11, 9).isValid = false;
            this.testScenario.getGameWorld().map.getCell(11, 10).isValid = false;

            this.testScenario.getGameWorld().map.getCell(14, 4).isValid = false;
            this.testScenario.getGameWorld().map.getCell(14, 5).isValid = false;
            this.testScenario.getGameWorld().map.getCell(14, 6).isValid = false;
            this.testScenario.getGameWorld().map.getCell(15, 4).isValid = false;
            this.testScenario.getGameWorld().map.getCell(15, 5).isValid = false;
            this.testScenario.getGameWorld().map.getCell(15, 6).isValid = false;
            this.testScenario.getGameWorld().map.getCell(16, 4).isValid = false;
            this.testScenario.getGameWorld().map.getCell(16, 5).isValid = false;

            this.testScenario.getGameWorld().map.getCell(4, 4).isValid = false;
            this.testScenario.getGameWorld().map.getCell(4, 5).isValid = false;
            this.testScenario.getGameWorld().map.getCell(4, 6).isValid = false;
            this.testScenario.getGameWorld().map.getCell(5, 4).isValid = false;
            this.testScenario.getGameWorld().map.getCell(5, 5).isValid = false;
            this.testScenario.getGameWorld().map.getCell(5, 6).isValid = false;
            this.testScenario.getGameWorld().map.getCell(6, 4).isValid = false;
            this.testScenario.getGameWorld().map.getCell(6, 5).isValid = false;

            ///Set controller
            testGameController = new ZRTSLogic.Controller(testScenario);

            ///Add a unit at (17, 17)
            this.testGameController.addUnit(new ZRTSModel.Entities.Unit(testGameController.scenario.getWorldPlayer(), 20), 17, 17);

            ///Initialize Player's resources
            this.testScenario.getPlayer().player_resources[0] = 150;
            this.testScenario.getPlayer().player_resources[1] = 150;
            this.testScenario.getPlayer().player_resources[2] = 150;
            this.testScenario.getPlayer().player_resources[3] = 150;
        }
        /// <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
            this.IsMouseVisible = true;
            Font1 = Content.Load <SpriteFont>("SpriteFont1");

            // Create Scenario
            this.testScenario = new ZRTSModel.Scenario.Scenario(graphics.PreferredBackBufferWidth / 20, 20);

            // The most challenging obstacles
            //createTestGameWorld();

            // Empty Map
            //createEmptyTestGameWorld();

            // Simulating gameplay
            createTestGameWorldSimulateBuildings();


            // Controller
            this.testGameController = new ZRTSLogic.Controller(this.testScenario);

            // Dummy unit
            //this.testScenario.getGameWorld().getUnits().Add(new ZRTSModel.Entities.Unit(0, 20, 100, 50, 0));
            /** NOTE: Adding Entities should be done through the Controller from now on **/
            //this.testGameController.addUnit(new ZRTSModel.Entities.Unit(testGameController.scenario.getWorldPlayer(), 20, 100, 50, 0), 5, 10);
            ZRTSModel.Entities.Unit unit1 = new ZRTSModel.Entities.Unit(testGameController.scenario.getPlayer(), 100);
            ZRTSModel.Entities.Unit unit2 = new ZRTSModel.Entities.Unit(testGameController.scenario.getZombiePlayer(), 100);
            this.testGameController.addUnit(unit1, 10, 5);
            this.testGameController.addUnit(unit2, 20, 10);
            unit2.setAttackStance(ZRTSModel.Entities.Unit.AttackStance.Agressive);
            unit1.setAttackStance(ZRTSModel.Entities.Unit.AttackStance.Guard);


            testGameController.scenario.getPlayer().player_resources[0] = 300;
            testGameController.scenario.getPlayer().player_resources[1] = 300;
            testGameController.scenario.getPlayer().player_resources[2] = 300;
            testGameController.scenario.getPlayer().player_resources[3] = 300;

            input     = new MouseState();
            prevInput = input;

            gameSelectView = new ViewSelect();
            base.Initialize();
        }
 /// <summary>
 /// Loading game scenario object for process
 /// </summary>
 /// <param name="scene"></param>
 public void LoadScenario(ZRTSModel.Scenario.Scenario scene)
 {
     this.scenario = scene;
 }
        /// <summary>
        /// Loading game scenario object for process
        /// </summary>
        /// <param name="scene"></param>
        public void LoadScenario(ZRTSModel.Scenario.Scenario scene)
        {
            // Need not to load this scenario into View
            // Basically just return a command corresponding to the clicked icon
            // i.e. click at attack icon, will return attack command and then process the game logic in the gameloop inside ZRTS update();

            this.scenario = scene;
        }
 /// <summary>
 /// Loading game scenario object for process
 /// </summary>
 /// <param name="scene"></param>
 public void LoadScenario(ZRTSModel.Scenario.Scenario scene)
 {
     this.scenario = scene;
 }
        /// <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
            this.IsMouseVisible = true;
            Font1 = Content.Load<SpriteFont>("SpriteFont1");

            // Create Scenario
            this.testScenario = new ZRTSModel.Scenario.Scenario(graphics.PreferredBackBufferWidth/20, 20);

            // The most challenging obstacles
            //createTestGameWorld();

            // Empty Map
            //createEmptyTestGameWorld();

            // Simulating gameplay
            createTestGameWorldSimulateBuildings();

            // Controller
            this.testGameController = new ZRTSLogic.Controller(this.testScenario);

            // Dummy unit
            //this.testScenario.getGameWorld().getUnits().Add(new ZRTSModel.Entities.Unit(0, 20, 100, 50, 0));
            /** NOTE: Adding Entities should be done through the Controller from now on **/
            //this.testGameController.addUnit(new ZRTSModel.Entities.Unit(testGameController.scenario.getWorldPlayer(), 20, 100, 50, 0), 5, 10);
            ZRTSModel.Entities.Unit unit1 = new ZRTSModel.Entities.Unit(testGameController.scenario.getPlayer(), 100);
            ZRTSModel.Entities.Unit unit2 = new ZRTSModel.Entities.Unit(testGameController.scenario.getZombiePlayer(), 100);
            this.testGameController.addUnit(unit1, 10, 5);
            this.testGameController.addUnit(unit2, 20, 10);
            unit2.setAttackStance(ZRTSModel.Entities.Unit.AttackStance.Agressive);
            unit1.setAttackStance(ZRTSModel.Entities.Unit.AttackStance.Guard);

            testGameController.scenario.getPlayer().player_resources[0] = 300;
            testGameController.scenario.getPlayer().player_resources[1] = 300;
            testGameController.scenario.getPlayer().player_resources[2] = 300;
            testGameController.scenario.getPlayer().player_resources[3] = 300;

            input = new MouseState();
            prevInput = input;

            gameSelectView = new ViewSelect();
            base.Initialize();
        }