Exemplo n.º 1
0
 public Mayor(Game game) : base(game, CellState.Mayor, MOVING_SPEED,
                                new Point(START_X, START_Z),
                                ResourcesHUD.START_POPULATION, STEP_TIME)
 {
     this.mayorMenu      = null;
     this.WindmillExists = false;
     this.BankExists     = false;
     this.MarketExists   = false;
     this.BarracksExists = false;
     AssignmentHelper.FillList(this.OnRecallBuildersEvent, this.OnAddBuildersEvent, this.OnRecallLumberjacksEvent, this.OnAddLumberjacksEvent,
                               this.OnRecallMinersEvent, this.OnAddMinersEvent, this.OnRecallFarmersEvent, this.OnAddFarmersEvent,
                               this.OnRecallBankersEvent, this.OnAddBankersEvent, this.OnRecallSellersEvent, this.OnAddSellersEvent);
     TrainingMenuHelper.FillList(this.OnAddSwordmenEvent, this.OnAddArchersEvent, this.OnAddBatteringRamEvent);
     this.resourcesHUD     = game.Components.OfType <ResourcesHUD>().ElementAt(0);
     this.calculatePayment = new Dictionary <PrivilegesCosts, Int16[]>()
     {
         { PrivilegesCosts.CommonWorker, new Int16[4] {
               0, 0, 0, 1
           } },                                                         //{stone, wood, gold, food}
         { PrivilegesCosts.PrivilegedWorker, new Int16[4] {
               0, 0, 1, 4
           } },
         { PrivilegesCosts.Soldier, new Int16[4] {
               5, 1, 5, 5
           } }
     };
 }
Exemplo n.º 2
0
        public void SetParent(Object parent, ref ResourcesHUD resourcesHUD)
        {
            this.gameField = parent as GameField;
            this.gameField.OnResourceClicked += new GameField.ResourceClicked(gameField_OnResourceClicked);

            this.resourcesHUD = resourcesHUD;
        }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
0
 public virtual void SetResourcesHUDObject(ref ResourcesHUD resourcesHUD)
 {
     this.resourcesHUD = resourcesHUD;
 }
 public void SetParent(Object parent, ref ResourcesHUD resourcesHUD)
 {
     this.gameField = parent as GameField;   //Yeah, I know, we can pass GameField -object directly, but it's not fun at all
     this.gameField.OnNotEmptyClicked += new GameField.NotEmptyClicked(gameField_OnNotEmptyClicked);
     this.resourcesHUD = resourcesHUD;
 }