Example #1
0
        public void GetTechnologyResponse_InstantiateCorrectly(Tuple <Technology, TechnologyResponse> data)
        {
            TechnologyResponse result = TechnologyFactory.GetTechnologyResponse(data.Item1);

            Assert.AreEqual(data.Item2.Id, result.Id);
            Assert.AreEqual(data.Item2.Name, result.Name);
        }
 public TechnologyCreateHandler(GlobalSolusindoDb db, tblM_User user, TechnologyValidator technologyValidator, TechnologyFactory technologyFactory, TechnologyQuery technologyQuery, AccessControl accessControl) : base(db, user)
 {
     this.technologyValidator         = technologyValidator;
     this.technologyFactory           = technologyFactory;
     this.technologyQuery             = technologyQuery;
     this.technologyEntryDataProvider = new TechnologyEntryDataProvider(db, user, accessControl, technologyQuery);
 }
Example #3
0
 public TechnologyUpgradeActiveAction(IWorld world,
                                      Formula formula,
                                      ILocker locker,
                                      TechnologyFactory technologyFactory,
                                      CallbackProcedure callbackProcedure)
 {
     this.world             = world;
     this.formula           = formula;
     this.locker            = locker;
     this.technologyFactory = technologyFactory;
     this.callbackProcedure = callbackProcedure;
 }
Example #4
0
 public TechnologyUpgradeActiveAction(uint cityId,
                                      uint structureId,
                                      uint techId,
                                      IWorld world,
                                      Formula formula,
                                      ILocker locker,
                                      TechnologyFactory technologyFactory,
                                      CallbackProcedure callbackProcedure)
     : this(world, formula, locker, technologyFactory, callbackProcedure)
 {
     this.cityId      = cityId;
     this.structureId = structureId;
     this.techId      = techId;
 }
Example #5
0
    void InitGame()
    {
        techFactory = new TechnologyFactory();

        CreatePlayers();

        //Setup starmap based on player input
        StarScreenManager screenManager = GameObject.Find("StarCollider").GetComponent <StarScreenManager>();

        generator.SetupScene(starData);
        SetupHomeworlds();

        screenManager.maxStarPositions = -generator.maxStarPositions;
        screenManager.minStarPositions = -generator.minStarPositions;
    }
Example #6
0
 public CityPassiveAction(uint cityId,
                          IObjectTypeFactory objectTypeFactory,
                          ILocker locker,
                          Formula formula,
                          IActionFactory actionFactory,
                          Procedure procedure,
                          IGameObjectLocator locator,
                          IBattleFormulas battleFormulas,
                          IStructureCsvFactory structureFactory,
                          TechnologyFactory technologyFactory,
                          UnitFactory unitFactory)
     : this(objectTypeFactory, locker, formula, actionFactory, procedure, locator, battleFormulas, structureFactory, technologyFactory, unitFactory)
 {
     this.cityId = cityId;
 }
    public ResearchManager()
    {
        factory = GameManager.techFactory;

        researchSpendingBook = new Dictionary <string, float>();
        researchProgress     = new Dictionary <string, float>();
        techSelection        = new Dictionary <string, Technology>();
        possessedTech        = new Dictionary <string, List <Technology> >();

        researchSpendingBook["electronics"] = 0.16f;
        researchSpendingBook["energy"]      = 0.16f;
        researchSpendingBook["engines"]     = 0.16f;
        researchSpendingBook["weapons"]     = 0.16f;
        researchSpendingBook["biology"]     = 0.18f;
        researchSpendingBook["chemistry"]   = 0.18f;

        researchProgress["electronics"] = 0.0f;
        researchProgress["energy"]      = 0.0f;
        researchProgress["engines"]     = 0.0f;
        researchProgress["weapons"]     = 0.0f;
        researchProgress["biology"]     = 0.0f;
        researchProgress["chemistry"]   = 0.0f;

        techSelection["electronics"] = factory.GetTechLevel("electronics", 1);
        techSelection["energy"]      = factory.GetTechLevel("energy", 1);
        techSelection["engines"]     = factory.GetTechLevel("engines", 1);
        techSelection["weapons"]     = factory.GetTechLevel("weapons", 1);
        techSelection["biology"]     = factory.GetTechLevel("biology", 1);
        techSelection["chemistry"]   = factory.GetTechLevel("chemistry", 1);

        possessedTech["electronics"] = new List <Technology>();
        possessedTech["energy"]      = new List <Technology>();
        possessedTech["engines"]     = new List <Technology>();
        possessedTech["weapons"]     = new List <Technology>();
        possessedTech["biology"]     = new List <Technology>();
        possessedTech["chemistry"]   = new List <Technology>();
    }
Example #8
0
 public PlayerCommandLineModule(IPlayersRemoverFactory playerRemoverFactory,
                                IPlayerSelectorFactory playerSelectorFactory,
                                ICityRemoverFactory cityRemoverFactory,
                                Chat chat,
                                IDbManager dbManager,
                                ITribeManager tribeManager,
                                IWorld world,
                                ILocker locker,
                                IStructureCsvFactory structureFactory,
                                UnitFactory unitFactory,
                                TechnologyFactory technologyFactory)
 {
     this.playerRemoverFactory  = playerRemoverFactory;
     this.playerSelectorFactory = playerSelectorFactory;
     this.cityRemoverFactory    = cityRemoverFactory;
     this.chat              = chat;
     this.dbManager         = dbManager;
     this.tribeManager      = tribeManager;
     this.world             = world;
     this.locker            = locker;
     this.structureFactory  = structureFactory;
     this.unitFactory       = unitFactory;
     this.technologyFactory = technologyFactory;
 }
Example #9
0
        public CityPassiveAction(IObjectTypeFactory objectTypeFactory,
                                 ILocker locker,
                                 Formula formula,
                                 IActionFactory actionFactory,
                                 Procedure procedure,
                                 IGameObjectLocator locator,
                                 IBattleFormulas battleFormulas,
                                 IStructureCsvFactory structureFactory,
                                 TechnologyFactory technologyFactory,
                                 UnitFactory unitFactory)
        {
            this.objectTypeFactory = objectTypeFactory;
            this.locker            = locker;
            this.formula           = formula;
            this.actionFactory     = actionFactory;
            this.procedure         = procedure;
            this.locator           = locator;
            this.battleFormulas    = battleFormulas;
            this.structureFactory  = structureFactory;
            this.technologyFactory = technologyFactory;
            this.unitFactory       = unitFactory;

            CreateSubscriptions();
        }
 private void Initialize(TechnologyValidator technologyValidator, TechnologyFactory technologyFactory)
 {
     this.technologyValidator = technologyValidator;
     this.technologyFactory   = technologyFactory;
 }
Example #11
0
        public virtual decimal CalculateTotalCityExpense(ICity city, IStructureCsvFactory structureFactory, TechnologyFactory technologyFactory, UnitFactory unitFactory)
        {
            decimal expenses = 0m;

            Func <Resource, decimal> calculateCost = resource => resource.Crop + resource.Wood + resource.Gold * 2 + resource.Iron * 5 + resource.Labor * 100;

            foreach (var structure in city)
            {
                for (var lvl = 0; lvl <= structure.Lvl; lvl++)
                {
                    expenses += calculateCost(structureFactory.GetCost(structure.Type, lvl));
                }

                foreach (var technology in structure.Technologies)
                {
                    for (var lvl = 0; lvl <= technology.Level; lvl++)
                    {
                        expenses += calculateCost(technologyFactory.GetTechnology(technology.Type, (byte)lvl).TechBase.Resources);
                    }
                }
            }

            foreach (var unit in city.Template)
            {
                for (var lvl = 1; lvl <= unit.Value.Lvl; lvl++)
                {
                    expenses += calculateCost(unitFactory.GetUpgradeCost(unit.Value.Type, lvl));
                }
            }

            return(expenses);
        }
Example #12
0
 public TechnologyCreatePassiveAction(TechnologyFactory technologyFactory, CallbackProcedure callbackProcedure)
 {
     this.technologyFactory = technologyFactory;
     this.callbackProcedure = callbackProcedure;
 }