Beispiel #1
0
        public void UpdateTick(BeeWorldManager worldManager)
        {
            if (this.mBeeYard.IsUnlocked)
            {
                var lElapsedMinutes = worldManager.ElapsedTime.TotalMinutes;

                if (this.IsMowingLawn)
                {
                    this.mBeeYard.GrassGrowth =
                        Math.Max(sMinGrassGrowth, this.mBeeYard.GrassGrowth - (lElapsedMinutes * this.mLawnMower.SpeedFactor));

                    if (this.mBeeYard.GrassGrowth == sMinGrassGrowth)
                    {
                        this.IsMowingLawn = false;
                        this.mLawnMower = null;
                        this.mLawnMowingCompleteCallback();
                        this.mLawnMowingCompleteCallback = null;
                        this.mBeeWorldManager.ResetTimeRates();
                    }
                }
                else
                {
                    this.mBeeYard.GrassGrowth =
                        Math.Min(sMaxGrassGrowth, this.mBeeYard.GrassGrowth + (lElapsedMinutes * this.mBeeYard.RegrowthFactor));
                }
            }

            foreach (var lUpdatable in this.mUpdatables)
            {
                lUpdatable.UpdateTick(worldManager);
            }
        }
        public ScreenManagerComponent(Game game, IGameScreen initalGameScreen, BeeWorldManager beeWorldManager)
            : base(game)
        {
            if (initalGameScreen == null) throw new ArgumentNullException("initialGameScreen");
            if (beeWorldManager == null) throw new ArgumentNullException("beeWorldManager");

            this.mBeeWorldManager = beeWorldManager;

            this.Present(initalGameScreen);
        }
Beispiel #3
0
        /// <summary>
        /// Mows the lawn. This action will take some time.
        /// </summary>
        /// <param name="beeWorldManager"></param>
        /// <param name="lawnMower"></param>
        /// <param name="callback"></param>
        public void MowLawn(BeeWorldManager beeWorldManager, LawnMower lawnMower, Action callback)
        {
            System.Diagnostics.Debug.Assert(!this.IsMowingLawn);

            this.mBeeWorldManager.RealTimePerTick = TimeSpan.FromMilliseconds(300);
            this.mBeeWorldManager.BeeMinutesPerTick *= 2;
            this.mLawnMower = lawnMower;
            this.mLawnMowingCompleteCallback = callback;
            this.IsMowingLawn = true;
        }
Beispiel #4
0
        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;
        }
Beispiel #5
0
        public BeeYardManager(BeeWorldManager beeWorldManager, BeeYard beeYard)
        {
            if (beeWorldManager == null) throw new ArgumentNullException("beeWorldManager");
            if (beeYard == null) throw new ArgumentNullException("beeYard");

            this.mBeeWorldManager = beeWorldManager;
            this.mBeeYard = beeYard;

            this.mBeeHiveManagers = new BeeHiveManager[this.mBeeYard.MaxHiveCount];
            for (int lIndex = 0; lIndex < this.mBeeHiveManagers.Length; lIndex++)
            {
                var lHiveManager = new BeeHiveManager(this.mBeeWorldManager, this.mBeeYard, this.mBeeYard.BeeHives[lIndex]);
                this.mBeeHiveManagers[lIndex] = lHiveManager;
            }

            this.mUpdatables.AddRange(this.mBeeHiveManagers);
        }
Beispiel #6
0
        public HudComponent(BeeWorldManager worldManager, Vector2 screenSize)
        {
            this.mWorldManager = worldManager;
            this.mScreenSize = screenSize;

            const float lcHudHeight = 100f;
            const float lcHudWidth = 800f;

            this.mSize = new Vector2(lcHudWidth, lcHudHeight);
            this.mPosition = screenSize - this.mSize;

            const int lcProgressHeight = 10;
            this.mDayCountPosition = this.mPosition + new Vector2(sItemMargin);
            this.mDayProgressPosition = new Vector2(
                this.mDayCountPosition.X + this.mDayCountWidth + sItemMargin,
                this.mDayCountPosition.Y);
            this.mDayProgressSize = new Vector2(
                this.mSize.X - (3 * sItemMargin) - this.mDayCountWidth,
                lcProgressHeight);
            this.mDayProgressIndicatorSize = new Vector2(0, this.mDayProgressSize.Y);
        }
 public BeeWorldHudComponent(BeeWorldManager worldManager, Vector2 screenSize)
     : base(worldManager, screenSize)
 {
 }
Beispiel #8
0
        public void UpdateTick(BeeWorldManager worldManager)
        {
            var lElapsedMinutes = worldManager.ElapsedTime.TotalMinutes;

            const int lcMinimumBeePopulation = 50;

            if (this.mIsSmokingHive && (--this.mSmokingTicksRemaining == 0))
            {
                this.mSmoker = null;
                this.mIsSmokingHive = false;
                this.mSmokingCompleteCallback();
                this.mSmokingCompleteCallback = null;
            }

            if (this.mIsRemovingSuper && (--this.mSuperRemovalTickRemaining == 0))
            {
                this.mBeeHive.Supers.Remove(this.mSuperBeingRemoved);

                this.mSuperBeingRemoved = null;
                this.mIsRemovingSuper = false;
                this.mSuperRemovalCompleteCallback();
                this.mSuperRemovalCompleteCallback = null;
            }

            if (this.mIsRemovingQueen && (--this.mQueenRemovalTicksRemaining == 0))
            {
                var lQueenBee = this.mBeeHive.QueenBee;
                this.mPlayer.QueenBees.Add(lQueenBee);
                this.mBeeHive.QueenBee = null;

                this.mIsRemovingQueen = false;
                this.mQueenRemovalCompleteCallback();
                this.mQueenRemovalCompleteCallback = null;
            }

            if (this.mIsAddingQueen && (--this.mQueenAddTicksRemaining == 0))
            {
                this.mBeeHive.QueenBee = this.mQueenBeeToAdd;
                this.mPlayer.QueenBees.Remove(this.mQueenBeeToAdd);

                this.mIsAddingQueen = false;
                this.mQueenBeeToAdd = null;
                this.mQueenAddCompleteCallback();
                this.mQueenAddCompleteCallback = null;
            }

            int lQueenPopulationFactor = 0;
            int lQueenStrengthFactor = 0;
            int lQueenAgressionFactor = 5;
            int lQueenSwarmFactor = 0;

            if (this.mBeeHive.QueenBee != null)
            {
                lQueenPopulationFactor = this.mBeeHive.QueenBee.BeePopulationGrowthFactor;
                lQueenStrengthFactor = this.mBeeHive.QueenBee.ColonyStrengthFactor;
                lQueenAgressionFactor = this.mBeeHive.QueenBee.NaturalBeeAgressionFactor;
                lQueenSwarmFactor = this.mBeeHive.QueenBee.SwarmLikelinessFactor;
            }

            var lNewPopulation = this.CalculateNewPopulation(
                lElapsedMinutes, this.mBeeHive.Population, lQueenPopulationFactor);
            this.mBeeHive.Population = Math.Max(lcMinimumBeePopulation, lNewPopulation);

            this.mBeeHive.ColonyStrength = this.CalculateColonyStrenth(
                this.mBeeHive.Population, lQueenStrengthFactor);

            this.mBeeHive.ColonyAgressiveness = this.CalculateNewColonyAgression(
                lElapsedMinutes, this.mBeeHive.ColonyAgressiveness, lNewPopulation, lQueenAgressionFactor);

            this.mBeeHive.ColonySwarmLikeliness = this.CalculateNewColonySwarmLikliness(
                this.mBeeHive.ColonySwarmLikeliness, lNewPopulation, lQueenSwarmFactor, this.mBeeYard.GrassGrowth);

            this.UpdateHoneyCollection(lElapsedMinutes);
        }
 public ShopScreenHudComponent(BeeWorldManager worldManager, Vector2 screenSize)
     : base(worldManager, screenSize)
 {
     this.mPlayer = worldManager.PlayerManager.Player;
 }
Beispiel #10
0
 public PlayerManager(BeeWorldManager worldManager)
 {
     this.mWorldManager = worldManager;
 }
Beispiel #11
0
        public void UpdateTick(BeeWorldManager worldManager)
        {
            if (this.mPlayer == null) return;

            if (this.IsTraveling && (--this.mTravelTicksRemaining == 0))
            {
                this.mIsTraveling = false;
                this.mWorldManager.ResetTimeRates();
                this.mTravelCompleteCallback();
            }

            foreach (var lUpdatable in this.mUpdatables)
            {
                lUpdatable.UpdateTick(worldManager);
            }
        }
Beispiel #12
0
 public void Load(int id, BeeWorldManager beeWorldManager)
 {
     throw new NotImplementedException();
 }
 public BeeHiveHudComponent(BeeWorldManager beeWorldManager, Vector2 screenSize)
     : base(beeWorldManager, screenSize)
 {
 }