示例#1
0
        public void Setup()
        {
            player = new Player();
            player.width = 50;
            player.height = 50;

            thrownObject = new ThrowObject();
            thrownObject.width = 50;
            thrownObject.height = 50;

            level = new Level();
            level.Player = (Player)player;
            level.ThrownObjects = new List<ThrowObject>();
            level.ThrownObjects.Add((ThrowObject)thrownObject);

            throwAttack = new ThrowAttack();
            throwAttack.SetLevel(level);
            thrownObject.SetLevel(level);
            player.SetLevel(level);
            throwingEnemy = new LittleEnemy();
            throwingEnemy.SetAttack(throwAttack);
        }
示例#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
 // TESTING METHODS
 public void SetAttack(ThrowAttack throwAttack)
 {
     _attack = throwAttack;
 }