コード例 #1
0
 public void SmokeHive(Smoker smoker, Action callback)
 {
     this.mSmoker = smoker;
     this.mSmokingCompleteCallback = callback;
     this.mSmokingTicksRemaining = 5;
     this.mIsSmokingHive = true;
 }
コード例 #2
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);
        }