public VillagerManager(Texture2D villagerTexture, CowManager cowManager, CollisionManager collisionManager, MeatStore meatStore)
        {
            this.villagerTexture = villagerTexture;
            villagers = new Queue<Villager>();
            outVillagers = new List<Villager>();
            justReturnedVillagers = new List<Villager>();

            this.collisionManager = collisionManager;
            this.cowManager = cowManager;

            for (int i = 0; i < maxVillagers; ++i)
            {
                CreateVillager();                
            }
            
            
            oldState = Keyboard.GetState();
            newState = oldState;
            this.meatStore = meatStore;
        }
 public void SetMeatStore(MeatStore meatStore)
 {
     this.meatStore = meatStore;
 }
Esempio n. 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create cow manager
            cowManager = new CowManager(collisionManager, Content.Load<Texture2D>("art//healthBar1"), Content.Load<Texture2D>("art//healthBar2"));
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            background = Content.Load<Texture2D>("art//bg");
            Texture2D wallTexture = Content.Load<Texture2D>("art//Wall_Block");

            font = Content.Load<SpriteFont>("ScoreFont");
            meatStore = new MeatStore(font, Content.Load<Texture2D>("art//storebackground"));

            cowManager.AddTexture(typeof(KamikazeCow), Content.Load<Texture2D>("art//Cow_Piece_kamikaze_cow"));
            cowTexture = Content.Load<Texture2D>("art//Cow_Piece");
            cowManager.AddTexture(typeof(Cow), cowTexture);
            cowManager.AddTexture(typeof(Bull), Content.Load<Texture2D>("art//Cow_Piece_bull"));
            cowManager.AddTexture(typeof(Meat), Content.Load<Texture2D>("art//meat"));

            catapult = new Catapult(Content.Load<Texture2D>("art//catapult"), Content.Load<Texture2D>("art//line"), Content.Load<Texture2D>("art//ammo"), collisionManager);
            wallManager = new WallManager(wallTexture);
            cowManager.SetWallManager(wallManager);
            Texture2D villagerTexture = Content.Load<Texture2D>("art//villager");
            villagerManager = new VillagerManager(villagerTexture, cowManager, collisionManager, meatStore);

            meatStore.addTexture(typeof(NewTowerStoreItem), wallTexture);
            meatStore.addTexture(typeof(NewVillagerStoreItem), villagerTexture);
            meatStore.addTexture(typeof(DamageUpgrade), Content.Load<Texture2D>("art//DamageUpgrade"));
            NewTowerStoreItem towerStoreItem = new NewTowerStoreItem(wallManager);
            NewVillagerStoreItem villagerItem = new NewVillagerStoreItem(villagerManager);
            DamageUpgrade damageUpgrade = new DamageUpgrade(catapult);
            //NewTowerStoreItem towerItem2 = new NewTowerStoreItem(wallManager);
            meatStore.addStoreItem(towerStoreItem);
            meatStore.addStoreItem(villagerItem);
            meatStore.addStoreItem(damageUpgrade);
            // TODO: use this.Content to load your game content here
        }