Esempio n. 1
0
 private void Inject(ArenaConfig config, Player player, EnemyPool enemyPool, BonusPool bonusPool)
 {
     _config    = config;
     _player    = player;
     _enemyPool = enemyPool;
     _bonusPool = bonusPool;
 }
Esempio n. 2
0
    public override void InstallBindings()
    {
        CalculateScreenSize();
        _config.Arena.Width       = ScreenWidthPercentToFloat(_config.Arena.Width);
        _config.Arena.Height      = ScreenHeightPercentToFloat(_config.Arena.Height);
        _config.Camera.BorderMove = 1 - 2 * _config.Camera.BorderMove / 100;

        Container.BindInstance(_config.Arena);
        Container.BindInstance(_config.Player);

        Container.BindInstance(_config.Enemies.SpeedyEnemy).WhenInjectedInto <SpeedyEnemy>();
        Container.BindInstance(_config.Enemies.HardyEnemy).WhenInjectedInto <HardyEnemy>();

        Container.BindInstance(_config.Bonuses.HealConfig).WhenInjectedInto <HealBonus>();
        Container.BindInstance(_config.Bonuses.ImmuneConfig).WhenInjectedInto <ImmuneBonus>();
        Container.BindInstance(_config.Bonuses.FireRateConfig).WhenInjectedInto <FireRateBonus>();

        Container.BindInstance(_config.Player.GunWeaponConfig).WhenInjectedInto <GunWeapon>();
        Container.BindInstance(_config.Player.RocketWeaponConfig).WhenInjectedInto <RocketWeapon>();

        Container.BindInstance(_config.Projectiles.RocketProjectile).WhenInjectedInto <RocketProjectile>();
        Container.BindInstance(_config.Projectiles.GunProjectile).WhenInjectedInto <GunProjectile>();

        Container.BindInstance(_config.Camera);

        ProjectilePool projectilePool = transform.Find("ProjectilePool").GetComponent <ProjectilePool>();

        Container.BindInstance(projectilePool);
        EnemyPool enemyPool = transform.Find("EnemyPool").GetComponent <EnemyPool>();

        Container.BindInstance(enemyPool);
        BonusPool bonusPool = transform.Find("BonusPool").GetComponent <BonusPool>();

        Container.BindInstance(bonusPool);

        Container.BindInstance(_config.Projectiles.GunProjectile.PoolSize).WhenInjectedIntoInstance(projectilePool);
        Container.BindInstance(_config.Enemies.HardyEnemy.PoolSize).WhenInjectedIntoInstance(enemyPool);
        Container.BindInstance(2).WhenInjectedIntoInstance(bonusPool);

        Player player = transform.Find("Player").GetComponent <Player>();

        Container.BindInstance(player);

        Container.Bind <EnemyFactory>().AsSingle().WithArguments(transform.Find("EnemyPool"));
        Container.Bind <ProjectileFactory>().AsSingle().WithArguments(transform.Find("ProjectilePool"));
        Container.Bind <BonusFactory>().AsSingle().WithArguments(transform.Find("BonusPool"));


        var gunWeapon = player.transform.Find("GunWeapon").GetComponent <GunWeapon>();

        Container.Bind <IWeapon>().FromInstance(gunWeapon);

        var rocketWeapon = player.transform.Find("RocketWeapon").GetComponent <RocketWeapon>();

        Container.Bind <IWeapon>().FromInstance(rocketWeapon);
    }
        public ActionResult Calculate(BonusPoolCalculatorModel model)
        {
            BonusPool newBonusPool = new BonusPool(new MvcInterviewV3Entities1());

            BonusPoolCalculatorResultModel result = new BonusPoolCalculatorResultModel();

            result.bonusPoolAllocation = newBonusPool.CalculateByEmployeeId(model.SelectedEmployeeId, model.BonusPoolAmount);

            return(View(result));
        }
Esempio n. 4
0
        public void BonusAllocationCalculation_CalculateBonusAllocation_ReturnBonusAllocation()
        {
            var allocation = new Allocation();
            var employee   = new HrEmployee();
            var payroll    = new Payroll();
            var bonusPool  = new BonusPool();

            employee.Salary            = 50000;
            payroll.TotalCostToCompany = 1000000;
            bonusPool.BonusPoolAmount  = 1000;

            var result = allocation.BonusAllocationCalculation(employee, payroll, bonusPool);

            Assert.AreEqual(result, 50);
        }
Esempio n. 5
0
        public Monster GenerateOneMonster()
        {
            Monster monster = new Monster();

            monster.Model       = GameModel.ModelGeometryCompiler.LoadModel("default");
            monster.DisplayName = "monster. kill me please.";
            Vector3 pos = new Vector3(RNG.NextInt(63), 0, RNG.NextInt(63));

            monster.Position             = pos;
            monster.LeashRadius          = 30;
            monster.PrimaryLootRollCount = 2;
            monster.PrimaryLootTable     = new List <Tuple <int, Item> >();
            ItemConsumable potA = new ItemConsumable
            {
                Colour = new Color(200, 50, 0),
                Name   = "HP potion"
            };
            ItemConsumable potB = new ItemConsumable
            {
                Colour = new Color(0, 100, 200),
                Name   = "MP potion"
            };
            Material  matA  = Material.MaterialTemplates.GetRandomMaterial();
            ItemEquip weapA = new ItemEquip();

            BonusPool p = BonusPool.Load("heavy_0_10");

            weapA.Bonuses.Add(p.PickBonus());
            weapA.Bonuses.Add(p.PickBonus());
            weapA.SubType           = RNG.NextInt(0, 1) * 4;
            weapA.PrimaryMaterial   = Material.MaterialTemplates.GetRandomMaterial();
            weapA.SecondaryMaterial = Material.MaterialTemplates.GetRandomMaterial();
            monster.PrimaryLootTable.Add(new Tuple <int, Item>(5, potA));
            monster.PrimaryLootTable.Add(new Tuple <int, Item>(5, potB));
            monster.PrimaryLootTable.Add(new Tuple <int, Item>(1, matA));
            monster.PrimaryLootTable.Add(new Tuple <int, Item>(3, null));
            monster.PrimaryLootTable.Add(new Tuple <int, Item>(10, weapA));

            return(monster);
        }
        public ActionResult Calculate(BonusPoolCalculatorModel model)
        {
            int        selectedEmployeeId = model.SelectedEmployeeId;
            int        totalBonusPool     = model.BonusPoolAmount;
            HrEmployee hrEmployee         = (HrEmployee)db.HrEmployees.FirstOrDefault(item => item.ID == selectedEmployeeId);

            Payroll payroll = new Payroll();

            payroll.AllEmployees       = getEmployees();
            payroll.TotalCostToCompany = payroll.PayrollCostTocompany(payroll.AllEmployees);

            BonusPool bonusPool = new BonusPool();

            bonusPool.BonusPoolAmount = totalBonusPool;

            BonusPoolCalculatorResultModel result = new BonusPoolCalculatorResultModel();
            Allocation allocation = new Allocation();

            result.hrEmployee          = hrEmployee;
            result.bonusPoolAllocation = allocation.BonusAllocationCalculation(hrEmployee, payroll, bonusPool);
            return(View(result));
        }
Esempio n. 7
0
        GameObject.Item MakeRandomEquip()
        {
            ItemEquip eq = new ItemEquip();
            BonusPool p  = BonusPool.Load("heavy_0_10");

            eq.Bonuses.Add(p.PickBonus());
            eq.Bonuses.Add(p.PickBonus());
            eq.ResetSockets(1);
            eq.Sockets[0] = new ItemGemstone("HP", 4);
            Enchantment enc     = new Enchantment();
            int         enctype = GameObject.RNG.Next(0, 3);

            switch (enctype)
            {
            case 0:
            {
                enc = new Enchantment()
                {
                    Effecttext = "Fire damage +{0}%", Type = "dmg_scale_fire"
                };
                enc.LineColour = new Color(255, 50, 30);
                enc.Multiplier = 0.15f;
                break;
            }

            case 1:
            {
                enc = new Enchantment()
                {
                    Effecttext = "Water resistance +{0}%", Type = "element_multiplier_water"
                };
                enc.LineColour = new Color(0, 50, 200);
                enc.Multiplier = 0.05f;
                break;
            }

            case 2:
            {
                enc = new Enchantment()
                {
                    Effecttext = "Reduces poisoning duration by +{0}%", Type = "element_dot_time_poison"
                };
                enc.LineColour = new Color(0, 150, 20);
                enc.Multiplier = 0.33f;
                break;
            }
            }
            eq.Enchant = enc;
            eq.SubType = GameObject.RNG.Next(0, 10);
            if (eq.SubType == 7)
            {
                eq.SubType = 18;
            }
            if (eq.SubType == 8)
            {
                eq.SubType = 27;
            }
            if (eq.SubType == 9)
            {
                eq.SubType = 15;
            }
            eq.PrimaryMaterial   = Material.MaterialTemplates.GetRandomMaterial();
            eq.SecondaryMaterial = Material.MaterialTemplates.GetRandomMaterial();
            eq.StackSize         = 1;
            return(eq);
        }
Esempio n. 8
0
        private void OKButton_Clicked(object sender, EventArgs e)
        {
            GameObject.Item Item;
            Item                = GameObject.Items.Material.MaterialTemplates.GetRandomMaterial();
            Item.SubType        = GameObject.RNG.Next(GameObject.Items.Material.MaterialType.Max);
            Item.Description    = "A " + GameObject.Items.Material.MaterialType.GetTypeName(Item.SubType) + " made from " + Item.Name + ". Used in crafting equipment.";
            this.OKButton.Title = Item.GetName();
            this.slot.Item      = Item;
            ItemEquip eq = new ItemEquip();
            BonusPool p  = BonusPool.Load("heavy_0_10");

            eq.Bonuses.Add(p.PickBonus());
            eq.Bonuses.Add(p.PickBonus());
            Enchantment enc     = new Enchantment();
            int         enctype = GameObject.RNG.Next(0, 3);

            switch (enctype)
            {
            case 0:
            {
                enc = new Enchantment()
                {
                    Effecttext = "Fire damage +{0}%", Type = "dmg_scale_fire"
                };
                enc.LineColour = new Color(255, 50, 30);
                enc.Multiplier = 0.15f;
                break;
            }

            case 1:
            {
                enc = new Enchantment()
                {
                    Effecttext = "Water resistance +{0}%", Type = "element_multiplier_water"
                };
                enc.LineColour = new Color(0, 50, 200);
                enc.Multiplier = 0.05f;
                break;
            }

            case 2:
            {
                enc = new Enchantment()
                {
                    Effecttext = "Reduces poisoning duration by +{0}%", Type = "element_dot_time_poison"
                };
                enc.LineColour = new Color(0, 150, 20);
                enc.Multiplier = 0.33f;
                break;
            }
            }
            eq.Enchant = enc;
            eq.SubType = GameObject.RNG.Next(0, 10);
            if (eq.SubType == 7)
            {
                eq.SubType = 18;
            }
            if (eq.SubType == 8)
            {
                eq.SubType = 27;
            }
            if (eq.SubType == 9)
            {
                eq.SubType = 15;
            }
            eq.PrimaryMaterial   = Material.MaterialTemplates.GetRandomMaterial();
            eq.SecondaryMaterial = Material.MaterialTemplates.GetRandomMaterial();
            List <string> ToolTip = eq.GetTooltip();

            this.slot.Item = eq;
            Console.WriteEx("New item is ^BEGINLINK " + Renderer.ColourToCode(eq.NameColour) + "[" + eq.GetName() + "] ^ENDLINK .^FFFFFF Click name to see more.", new List <Action> {
                new Action(() => { ToolTipWindow tip = new ToolTipWindow(this.WM, ToolTip, WM.MouseX, WM.MouseY, false);
                                   WM.Add(tip); })
            });
            //this.Player.EquipItem(eq);
            this.Title = this.Player.CalculateStat("HP").ToString();
        }