public void TestSpriteRemoving() { Item medKit1, medKit2, weapon1; medKit1 = new MedKit(); medKit2 = new MedKit(); weapon1 = new ShootableWeapon(); layer.addSprite(medKit1); layer.addSprite(medKit2); layer.addSprite(weapon1); layer.Sprites.Remove(medKit2); Assert.AreSame((int)layer.Sprites.Count, 2); }
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); }
public void loadContent() { TextureLoader textureLoader = TextureLoader.GetInstance(); Texture2D blockSpriteA = Content.Load<Texture2D>("blockA"); Texture2D blockSpriteB = Content.Load<Texture2D>("blockB"); Texture2D coin = Content.Load<Texture2D>("coin"); Texture2D background = Content.Load<Texture2D>("b"); Texture2D weapon_texture = Content.Load<Texture2D>("weapon"); Texture2D ammo_texture = Content.Load<Texture2D>("ammo"); textureLoader.addTexture("blockA", blockSpriteA); textureLoader.addTexture("blockB", blockSpriteB); textureLoader.addTexture("coin", coin); textureLoader.addTexture("b", background); textureLoader.addTexture("weapon", weapon_texture); textureLoader.addTexture("ammo", ammo_texture); font = Content.Load<SpriteFont>("Font"); deadFont = Content.Load<SpriteFont>("DeadFont"); Texture2D ballSprite = Content.Load<Texture2D>("ball"); player = new Player(Vector2.Zero, 6.0f, new Rectangle(0, 0, 3900, 1200)); selected_level.SetPlayer(player); selected_level.Layers[0].addSprite(new Background(Vector2.Zero)); ShootableWeapon w1; w1 = new ShootableWeapon("ak47", weapon_texture, player._Position, 0); player.addWeapon(w1); player.SetCurrentWeapon(0); selected_level.addEnemy(50, 5); selected_level.Load(); Controller = new GameController(selected_level); }