public BeeYardHiveComponent(Texture2D blankTexture, BeeHive beeHive, BeeYardHiveInfo hiveInfo, SuperRepository superRepository)
 {
     this.mBlankTexture = blankTexture;
     this.mBeeHive = beeHive;
     this.mHiveInfo = hiveInfo;
     this.mSuperRepository = superRepository;
 }
        public BeeHiveManager(BeeWorldManager worldManager, BeeYard beeYard, BeeHive beeHive)
        {
            if (worldManager == null) throw new ArgumentNullException("beeWorldManager");
            if (beeYard == null) throw new ArgumentNullException("beeYard");
            if (beeHive == null) throw new ArgumentNullException("beeHive");

            this.mPlayer = worldManager.PlayerManager.Player;
            this.mWorldManager = worldManager;
            this.mBeeYard = beeYard;
            this.mBeeHive = beeHive;
        }
        public void CreateNew(
            int id, string name, PlayerAvatar avatar,
            IObjectRepository<BeeYard> beeYardRepository,
            IMetaObjectRepository<MetaSuper, Super> superRepository,
            IObjectRepository<LawnMower> lawnMowerRepository,
            IMetaObjectRepository<MetaQueenBee, QueenBee> queenRepository,
            IObjectRepository<Smoker> smokerRepository)
        {
            this.mPlayer = new Player();
            this.mPlayer.Id = id;
            this.mPlayer.Name = name;
            this.mPlayer.Avatar = avatar;
            this.mPlayer.CreationTime = DateTime.Now;
            this.mPlayer.LastPlayed = DateTime.Now;
            this.mPlayer.TotalRealTimePlayed = TimeSpan.Zero;
            this.mPlayer.BeeTime = new BeeTime();
            this.mPlayer.LawnMower = lawnMowerRepository.CreateObject(0);
            this.mPlayer.Smoker = smokerRepository.CreateObject(0);

            for (int lBeeYardId = 0; lBeeYardId < beeYardRepository.Count; lBeeYardId++)
            {
                var lBeeYard = beeYardRepository.CreateObject(lBeeYardId);
                this.mPlayer.BeeYards.Insert(lBeeYardId, lBeeYard);

                for (int lHiveIndex = 0; lHiveIndex <= lBeeYard.MaxHiveCount; lHiveIndex++)
                {
                    var lBeeHive = new BeeHive();
                    lBeeHive.Id = lHiveIndex;
                    lBeeYard.BeeHives.Insert(lHiveIndex, lBeeHive);
                }
            }

            var lFirstBeeYard = this.mPlayer.BeeYards[0];
            lFirstBeeYard.IsUnlocked = true;

            // TEST:
            this.mPlayer.BeeYards[1].IsUnlocked = true;
            for (int lIndex = 0; lIndex < 20; lIndex++) this.mPlayer.Supers.Add(superRepository.CreateObject(0));
            // -- End TEST

            var lFirstBeeHive = lFirstBeeYard.BeeHives[0];
            lFirstBeeHive.Supers.Add(superRepository.CreateObject(0), SuperType.BroodChamber);
            lFirstBeeHive.QueenBee = queenRepository.CreateObject(0);

            this.mWorldManager.Time.Reset(this.mPlayer.BeeTime);

            this.mBeeYardManagers.Clear();
            this.mBeeYardManagers.AddRange(
                this.mPlayer.BeeYards
                    .Select(x => new BeeYardManager(this.mWorldManager, x)));

            this.mUpdatables.Clear();
            this.mUpdatables.AddRange(this.mBeeYardManagers);
        }
        /// <summary>
        /// Travels to the given bee hive in the current bee yard. This method should
        /// only be called when the player is already at a bee yard. Traveling can only occur
        /// to a bee hive in the current bee yard.
        /// </summary>
        /// <param name="beeHive"></param>
        public void TravelTo(BeeHive beeHive)
        {
            System.Diagnostics.Debug.Assert(this.mPlayer.Location == PlayerLocation.BeeYard);
            System.Diagnostics.Debug.Assert(this.mPlayer.CurrentBeeYard.BeeHives.Contains(beeHive));

            this.mPlayer.CurrentBeeHive = beeHive;
            this.mPlayer.Location = PlayerLocation.BeeHive;
        }
        public override void LoadContent()
        {
            base.LoadContent();

            var lPlayerManager = this.ScreenManager.BeeWorldManager.PlayerManager;
            this.mPlayer = lPlayerManager.Player;
            System.Diagnostics.Debug.Assert(this.mPlayer.Location == PlayerLocation.BeeHive);
            this.mBeeHive = this.mPlayer.CurrentBeeHive;
            var lBeeYardManager = lPlayerManager.BeeYardManagers[this.mPlayer.CurrentBeeYard.Id];
            this.mBeeHiveManager = lBeeYardManager.BeeHiveManagers[this.mBeeHive.Id];

            this.mBlankTexture = this.ContentManager.Load<Texture2D>("Sprites/Blank");
            this.mMetaInfoFont = this.ContentManager.Load<SpriteFont>("Fonts/DefaultTiny");
            this.mSuperRepository = new SuperRepository(this.ContentManager);

            this.mButtonMenuComponent = new ButtonMenuComponent(this.ScreenSize);
            this.mButtonMenuComponent.LoadContent(this.ContentManager);
            this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonSupers);
            this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonQueen);
            this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonUseSmoker);
            this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonToYard);
            this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonToWorld);
            this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonSelectionCommit);
            this.mButtonMenuComponent.MenuButtons.Add(this.mMenuButtonSelectionCancel);

            this.mHudComponent = new BeeHiveHudComponent(this.ScreenManager.BeeWorldManager, this.ScreenSize);
            this.mHudComponent.LoadContent(this.ContentManager);

            this.mVerticalScrollUpBounds = new Rectangle(
                (int)((this.ScreenSize.X - this.mSuperWidth) / 2f), 0,
                this.mSuperWidth, this.mScrollBoundsHeight);
            this.mVerticalScrollDownBounds = new Rectangle(
                this.mVerticalScrollUpBounds.X,
                (int)this.mHudComponent.Position.Y - this.mVerticalScrollUpBounds.Height,
                this.mVerticalScrollUpBounds.Width,
                this.mVerticalScrollUpBounds.Height + (int)this.mHudComponent.Size.Y);

            this.mInventorySelectorComponent = new InventoryItemSelectorComponent(this.ScreenSize);
            this.mInventorySelectorComponent.LoadContent(this.ContentManager);

            this.mSuperTexture = new Texture2D(this.ScreenManager.Game.GraphicsDevice, 128, 128);
            this.mSuperTexture.SetData(Enumerable.Repeat(Color.Pink, 128 * 128).ToArray());

            this.mComponents.Add(this.mInventorySelectorComponent);
            this.mComponents.Add(this.mButtonMenuComponent);
            this.mComponents.Add(this.mHudComponent);
        }