Пример #1
0
    /// <summary>
    /// BaseIncome triggers all 5 seconds
    /// Zweites WaitForSeconds nötig da insgesamt 1 Sekunde vergehen muss wegen der Rundfunktion: Bsp. 4.5 wird auf 5 gerundet, nun vergeht 0.5 sekunden
    /// und wir haben immer noch 5, erst ab 5.51 wird die Zahl auf 6 gerundet, d.h. von 5 her müssen nochmals 0.5 Sekunden vergehen
    /// These scripts correspond directly with the CoinManagement.cs Script
    /// </summary>
    /// <returns></returns>
    IEnumerator BaseIncomeTick()
    {
        yield return(new WaitForSeconds(0.5001f));

        CoinManagement.AddCoins();
        MercenaryManagement.AddMercs();
        WisdomManagement.AddWisdom();
        CoinManagement.animateIncome        = true;
        MercenaryManagement.animateMercGain = true;
        WisdomManagement.animateWisdomGain  = true;
        yield return(new WaitForSeconds(0.5f));

        incomeInnerLoopSentinel = false;
        incomeCostAlternate     = false;
        yield return(new WaitForSeconds(0.00001f));
    }
Пример #2
0
    IEnumerator BaseCostTick()
    {
        yield return(new WaitForSeconds(0.5001f));

        CoinManagement.SubtractCoins();
        MercenaryManagement.SubtractMercs();
        WisdomManagement.SubtractWisdom();
        CoinManagement.animateCost          = true;
        MercenaryManagement.animateMercLoss = true;
        WisdomManagement.animateWisdomLoss  = true;
        yield return(new WaitForSeconds(0.5f));

        costInnerLoopSentinel = false;
        incomeCostAlternate   = true;
        yield return(new WaitForSeconds(0.00001f));
    }
Пример #3
0
        public static void InitializeRepository(IObjectContainer objectContainer)
        {
            CleanupRepository();

            var logger = new FakeLogger();

            objectContainer.RegisterInstanceAs <Logger>(logger);

            var rewardTemplatesRepository = new RewardTemplatesJsonFileRepository("rewardTemplates.json");

            objectContainer.RegisterInstanceAs <IRewardTemplatesRepository>(rewardTemplatesRepository);

            var valueRandomizer = new ValueRandomizer();

            objectContainer.RegisterInstanceAs <IValueRandomizer>(valueRandomizer);
            var accountRepo = new AccountJsonFileRepository("accounts.json");

            objectContainer.RegisterInstanceAs <IAccountRepository>(accountRepo);
            var refreshRepo = new RefreshJsonFileRepository(Directory.GetCurrentDirectory());

            objectContainer.RegisterInstanceAs <IRefreshRepository>(refreshRepo);
            var configRepo = new ConfigJsonFileRepository("configuration.json");

            objectContainer.RegisterInstanceAs <IConfigRepository>(configRepo);
            var accountManagement = new AccountManagement(accountRepo);

            objectContainer.RegisterInstanceAs <IAccountManagement>(accountManagement);
            var refreshingMechnism = new RefreshingMechnism(refreshRepo, configRepo, accountManagement);

            objectContainer.RegisterInstanceAs <IRefreshingMechnism>(refreshingMechnism);
            var mercenaryRepo = new MercenaryJsonFileRepository(Directory.GetCurrentDirectory());

            objectContainer.RegisterInstanceAs <IMercenaryRepository>(mercenaryRepo);
            var recruitRepo = new RecruitsJsonRepository(Directory.GetCurrentDirectory());

            objectContainer.RegisterInstanceAs <IRecruitsRepository>(recruitRepo);
            var mercenaryTemplateRepository = new MercenaryTemplateJsonFileRepository("mercenaryTemplates.json");

            objectContainer.RegisterInstanceAs <IMercenaryTemplateRepository>(mercenaryTemplateRepository);

            var packFormationRepository = new PackFormationJsonFileRepository(Directory.GetCurrentDirectory());

            objectContainer.RegisterInstanceAs <IPackFormationRepository>(packFormationRepository);

            var packFormationBuilder = new PackFormationBuilder(packFormationRepository, accountManagement);

            objectContainer.RegisterInstanceAs <IPackFormationBuilder>(packFormationBuilder);

            var itemTemplateRepository = new ItemTemplateJsonFileRepository("itemTemplates.json");

            objectContainer.RegisterInstanceAs <IItemTemplateRepository>(itemTemplateRepository);
            var positionInInventoryRepository = new PositionInInventoryJsonFileRepository(Directory.GetCurrentDirectory());

            objectContainer.RegisterInstanceAs <IPositionInInventoryRepository>(positionInInventoryRepository);
            var inventoryManagement = new InventoryManagement(itemTemplateRepository, positionInInventoryRepository, accountManagement);

            objectContainer.RegisterInstanceAs <IInventoryManagement>(inventoryManagement);

            var mercenaryManagement = new MercenaryManagement(mercenaryRepo, accountManagement, mercenaryTemplateRepository, valueRandomizer, configRepo, recruitRepo, inventoryManagement, refreshingMechnism);

            objectContainer.RegisterInstanceAs <IMercenaryManagement>(mercenaryManagement);

            var formationTemplateRepository = new FormationTemplateJsonFileRepository("formationTemplates.json");

            objectContainer.RegisterInstanceAs <IFormationTemplateRepository>(formationTemplateRepository);

            var opponentPackFormationBuilder = new OpponentPackFormationBuilder(formationTemplateRepository, mercenaryManagement);

            objectContainer.RegisterInstanceAs <IOpponentPackFormationBuilder>(opponentPackFormationBuilder);

            var fightMechanizm = new FightMechanizm(valueRandomizer);

            objectContainer.RegisterInstanceAs <IFightMechanizm>(fightMechanizm);

            var fightManagement = new FightManagement(opponentPackFormationBuilder, fightMechanizm, packFormationBuilder, mercenaryManagement);

            objectContainer.RegisterInstanceAs <IFightManagement>(fightManagement);

            var questRepository = new QuestsJasonFileRepository(Directory.GetCurrentDirectory());

            objectContainer.RegisterInstanceAs <IQuestRepository>(questRepository);
            var questManagement = new QuestManagement(configRepo, refreshingMechnism, valueRandomizer, formationTemplateRepository, accountManagement,
                                                      questRepository, rewardTemplatesRepository, inventoryManagement, itemTemplateRepository, fightManagement);

            objectContainer.RegisterInstanceAs <IQuestManagement>(questManagement);
        }