Пример #1
0
        public void AddWeapon(Weapon weapon)
        {
            _weapons.Add(weapon);

            if (_currentWeapon == null)
                SetCurrentWeapon(0);
        }
Пример #2
0
        private void LoadFeatures()
        {
            Weapon gun1, sword1, tazer;
            gun1 = new ShootableWeapon();
            gun1.TextureName = "gun";
            gun1.Initialize();

            sword1 = new Weapon();
            sword1.TextureName = "sword";
            sword1.Initialize();

            tazer = new Weapon();
            tazer.TextureName = "tazer";
            tazer.Initialize();

            IStrategyBehavior curiousStrategy, survivalStrategy, carefullStrategy;
            curiousStrategy = new CuriousStrategy();
            survivalStrategy = new SurvivalStrategy();
            carefullStrategy = new CarefullStrategy();

            IAttackBehavior Throwattack;
            Throwattack = new ThrowAttack();

            ((ThrowAttack)Throwattack).SetLevel(_selectedLevel);
            _featureLoader.AddAttack("ThrowAttack", Throwattack);

            IAttackBehavior headRollAttack = new HeadRollAttack();
            _featureLoader.AddAttack("headroll", headRollAttack);

            IAttackBehavior instaAttack = new InstaAttack();
            _featureLoader.AddAttack("InstaAttack", instaAttack);
            ((InstaAttack)instaAttack).Initialize();

            IAttackBehavior minonsAttack = new MinionAttack();
            _featureLoader.AddAttack("MinionsAttack", minonsAttack);

            IBoostBehavior meditationBoost;
            meditationBoost = new MeditationBoost(_textureLoader.GetTexture("meditationWings"));
            _featureLoader.AddBoost("MeditationBoost", meditationBoost);

            IBoostBehavior drinkBoost;
            drinkBoost = new DrinkBoost();
            _featureLoader.AddBoost("DrinkBoost", drinkBoost);

            IBoostBehavior calculatorBoost;
            calculatorBoost = new CalculatorBoost(_textureLoader.GetTexture("Boost"));
            _featureLoader.AddBoost("CalcBoost", calculatorBoost);

            _featureLoader.addStrategy("curious", curiousStrategy);
            _featureLoader.addStrategy("survival", survivalStrategy);
            _featureLoader.addStrategy("carefull", carefullStrategy);
            _featureLoader.AddWeapon("gun", gun1);
            _featureLoader.AddWeapon("sword", sword1);
            _featureLoader.AddWeapon("tazer", tazer);
        }
Пример #3
0
 public void SetCurrentWeapon(int which)
 {
     _currentWeapon = _weapons.ElementAt(which);
     _currentWeapon.Position = Position;
 }