Exemple #1
0
        public UnitConfig(int unitId)
        {
            _gameConfigRepository = CallContext <GameConfigRepository> .GetData("GameConfigRepository");

            var units = _gameConfigRepository.GetEntities("Unit");

            _unit                     = units.GetById(unitId);
            _unitActions              = _gameConfigRepository.GetEntities("UnitAction").Filter("UnitId", unitId);
            _unitMovements            = _gameConfigRepository.GetEntities("UnitMovement").Filter("UnitId", unitId);
            _unitBuildings            = _gameConfigRepository.GetEntities("UnitBuilding").Filter("UnitId", unitId);
            _unitRaces                = _gameConfigRepository.GetEntities("UnitRace").Filter("UnitId", unitId);
            _movementIncrementSightBy = _gameConfigRepository.GetEntities("MovementIncrementSightBy");

            ActionsThisUnitCanPerform        = _gameConfigRepository.ToList(_unitActions, "Action", "ActionId", "Name");
            MovementTypesThisUnitCanPerform  = _gameConfigRepository.ToList(_unitMovements, "Movement", "MovementId", "Name");
            BuildingsRequiredToBuildThisUnit = _gameConfigRepository.ToList(_unitBuildings, "Building", "BuildingId", "Name");
            RacesThatCanBuildThisUnit        = _gameConfigRepository.ToList(_unitRaces, "Race", "RaceId", "Name");
            MovementSightIncrements          = new List <int>();

            foreach (var item in _unitMovements)
            {
                var movementId = (int)item.MovementId;
                var movementIncrementSightBy = _movementIncrementSightBy.Filter("MovementId", movementId);
                foreach (var item2 in movementIncrementSightBy)
                {
                    MovementSightIncrements.Add((int)item2.Value);
                }
            }
        }
Exemple #2
0
        public RaceConfig(int raceId)
        {
            _gameConfigRepository = CallContext <GameConfigRepository> .GetData("GameConfigRepository");

            var races = _gameConfigRepository.GetEntities("Race");

            _race          = races.GetById(raceId);
            _raceTownNames = _gameConfigRepository.GetEntities("RaceTownName").Filter("RaceId", raceId);
            _unitRaces     = _gameConfigRepository.GetEntities("UnitRace").Filter("RaceId", raceId);
            _raceBuildings = _gameConfigRepository.GetEntities("RaceBuilding").Filter("RaceId", raceId);

            TownNamesForThisRace              = _gameConfigRepository.ToList(_raceTownNames, "TownName", "TownNameId", "Name");
            UnitsThatCanBeBuiltByThisRace     = _gameConfigRepository.ToList(_unitRaces, "Unit", "UnitId", "Name");
            BuildingsThatCanBeBuiltByThisRace = _gameConfigRepository.ToList(_raceBuildings, "Building", "BuildingId", "Name");
        }
Exemple #3
0
        public BuildingConfig(int buildingId)
        {
            _gameConfigRepository = CallContext <GameConfigRepository> .GetData("GameConfigRepository");

            var buildings = _gameConfigRepository.GetEntities("Building");

            _building          = buildings.GetById(buildingId);
            _raceBuildings     = _gameConfigRepository.GetEntities("RaceBuilding").Filter("BuildingId", buildingId);
            _unitBuildings     = _gameConfigRepository.GetEntities("UnitBuilding").Filter("BuildingId", buildingId);
            _requiredBuildings = _gameConfigRepository.GetEntities("RequiredBuilding").Filter("BuildingId", buildingId);

            RacesThatCanBuildThisBuilding        = _gameConfigRepository.ToList(_raceBuildings, "Race", "RaceId", "Name");
            UnitsThatAreRequiredByThisBuilding   = _gameConfigRepository.ToList(_unitBuildings, "Unit", "UnitId", "Name");
            BuildingsRequiredToBuildThisBuilding = _gameConfigRepository.ToList(_requiredBuildings, "Building", "RequiredBuildingId", "Name");

            MaximumPopulationIncrease    = DetermineMaximumPopulationIncrease(buildingId);
            PopulationGrowthRateIncrease = DeterminePopulationGrowthRateIncrease(buildingId);
            FoodOutputIncrease           = DetermineFoodOutputIncrease(buildingId);
        }