public virtual void LoadTextures()
 {
     this.menusCaller          = this.game.Components.OfType <MenusCaller>().ElementAt(0);
     this.pickingService       = this.game.GetService <PickingService>();
     this.menu.EnabledChanged += new EventHandler <EventArgs>(menu_EnabledChanged);
     this.personTex            = this.stopTex;
     this.frustum              = new BoundingFrustum(this.view * this.projection);
 }
示例#2
0
 /// <summary>
 /// Retrievs all services and components needed to start the game
 /// </summary>
 private void GetComponentsServicesToEnable()
 {
     this.cameraService   = this.Game.GetService <CameraService>();
     this.pickingService  = this.Game.GetService <PickingService>();
     this.gameScreen      = this.Game.Components.OfType <GameScreen>().ElementAt(0);
     this.gameField       = this.Game.Components.OfType <GameField>().ElementAt(0);
     this.humansParent    = this.Game.Components.OfType <HumansParent>().ElementAt(0);
     this.buildingsParent = this.Game.Components.OfType <BuildingsParent>().ElementAt(0);
     this.resourcesParent = this.Game.Components.OfType <ResourcesParent>().ElementAt(0);
     this.menuCaller      = this.Game.Components.OfType <MenusCaller>().ElementAt(0);
     this.resourcesHUD    = this.Game.Components.OfType <ResourcesHUD>().ElementAt(0);
 }
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            this.Game.RegisterGameComponent <GameField>(out this.gameField, true, true);
            this.pickingService = this.Game.GetService <PickingService>();
            this.Game.RegisterGameComponent <MenusCaller>(out this.menusCaller, true, true);
            this.Game.RegisterGameComponent <BuildingsSelector>(out this.buildingsSelector, false, false);
            this.menusCaller.SetSelector(ref this.buildingsSelector);
            this.menusCaller.EnabledChanged += new EventHandler <EventArgs>(menusCaller_EnabledChanged);
            this.gameField.SetBuildingsSelector(ref this.buildingsSelector);
            this.buildingsSelector.EnabledChanged += new EventHandler <EventArgs>(buildingsSelector_EnabledChanged);

            base.Initialize();
        }
示例#4
0
 public BuildingBase(Single next_stage_time, Game game, CellState type, Single currentHealth, BuildingState state)
 {
     this.pickingService       = game.GetService <PickingService>();
     NEXT_STAGE_TIME           = next_stage_time;
     this.timeToNextState      = NEXT_STAGE_TIME;
     this.buildingType         = type;
     this.game                 = game;
     this.effect               = new AlphaTestEffect(this.game.GraphicsDevice);
     this.state                = state;
     this.gameStateBuilding    = GameStateForBuilding.Normal;
     this.canStartConstruction = false;
     this.currentHealth        = currentHealth;
     this.isBoxConstructed     = false;
     this.canDraw              = false;
 }
示例#5
0
        private MessageBox(Game game) : base(game)
        {
            try
            {
                this.pickingService              = game.GetService <PickingService>();
                this.pickingService.Enabled      = false;
                this.buildingsMenuCaller         = game.Components.OfType <MenusCaller>().ElementAt(0);
                this.buildingsMenuCaller.Enabled = false;
                this.buildingsMenuCaller.Visible = false;
            }
            catch (Exception)
            { }

            this.lsBtns         = new List <Button <MessageBox> >();
            this.backgroundRect = new Rectangle(0, 0, game.GraphicsDevice.Viewport.Width, game.GraphicsDevice.Viewport.Height);
            this.iconRect       = new Rectangle(10, ICON_HEIGHT, ICON_WIDTH, ICON_HEIGHT);
            this.titlePos       = new Vector2(25 + ICON_WIDTH, ICON_HEIGHT);
            this.txtPos         = new Vector2(10, 2 * ICON_HEIGHT + 40);
        }