Exemple #1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_Bees       = (apiBeesComponent)reader.ReadItem();    //for displaying bee swarm
            m_Health     = reader.ReadInt();                       //current health
            m_NextCheck  = reader.ReadDateTime();                  //next update check
            m_Status     = (HiveStatus)reader.ReadInt();           //growth stage
            m_LastGrowth = (HiveGrowthIndicator)reader.ReadInt();  //last growth
            m_Age        = reader.ReadInt();                       //age of hive
            m_Population = reader.ReadInt();                       //bee population (*10k)
            m_Parasite   = reader.ReadInt();                       //parasite level(0, 1, 2)
            m_Disease    = reader.ReadInt();                       //disease level (0, 1, 2)
            m_Flowers    = reader.ReadInt();                       //amount of water tiles in range (during last check)
            m_Water      = reader.ReadInt();                       //number of flowers in range (during last check)
            m_Wax        = reader.ReadInt();                       //amount of Wax
            m_Honey      = reader.ReadInt();                       //amount of Honey
            m_PotAgility = reader.ReadInt();                       //number of agility potions
            m_PotHeal    = reader.ReadInt();                       //number of heal potions
            m_PotCure    = reader.ReadInt();                       //number of cure potions
            m_PotStr     = reader.ReadInt();                       //number of stength potions
            m_PotPoison  = reader.ReadInt();                       //number of poison potions
            m_Comp       = (apiBeeHiveComponent)reader.ReadItem(); //for storing the top of the hive
        }
Exemple #2
0
        public void Die()
        {
            //handle death
            if (HiveStage >= HiveStatus.Producing)
            {
                Population--;
                m_LastGrowth = HiveGrowthIndicator.PopulationDown;

                if (Population == 0)
                {
                    //hive is dead
                    HiveStage = HiveStatus.Empty;
                }
            }
            else
            {
                HiveStage = HiveStatus.Empty;
            }
            m_Bees.Visible = false;
        }
Exemple #3
0
		public void Die()
		{
			//handle death
			if( HiveStage >= HiveStatus.Producing )
			{
				Population--;
				m_LastGrowth = HiveGrowthIndicator.PopulationDown;

				if( Population == 0 )
				{
					//hive is dead
					HiveStage = HiveStatus.Empty;
				}
			}
			else
			{
				HiveStage = HiveStatus.Empty;
			}
			m_Bees.Visible=false;
		}
Exemple #4
0
		public void Grow()
		{
			if ( OverallHealth < HiveHealth.Healthy )
			{//not healthy enough to grow or produce
				if( m_LastGrowth != HiveGrowthIndicator.PopulationDown ) //population down takes precedence
					m_LastGrowth = HiveGrowthIndicator.NotHealthy;
			}
			else if ( ScaleFlower() < ResourceStatus.Low || ScaleWater() < ResourceStatus.Low )
			{//resources too low to grow or produce
				if( m_LastGrowth != HiveGrowthIndicator.PopulationDown ) //population down takes precedence
					m_LastGrowth = HiveGrowthIndicator.LowResources;
			}
			else if ( HiveStage < HiveStatus.Stage5 )
			{//not producing yet, so just grow
				int curStage = (int)HiveStage;
				HiveStage = (HiveStatus)( curStage + 1 );
				
				m_LastGrowth = HiveGrowthIndicator.Grown;
			}
			else
			{
				//production
				if( Wax < MaxWax )
				{
					int baseWax = 1;
					
					if( this.OverallHealth == HiveHealth.Thriving )
						baseWax++;

					baseWax += potAgility; //bees work harder

					baseWax *= Population;

					if( LessWax )
						baseWax = Math.Max( 1,( baseWax/3 ) );  //wax production is slower then honey
					
					Wax += baseWax;
					m_LastGrowth = HiveGrowthIndicator.Grown;
				}

				if( Honey < MaxHoney )
				{
					int baseHoney = 1;
					
					if( this.OverallHealth == HiveHealth.Thriving )
						baseHoney++;

					baseHoney += potAgility; //bees work harder

					baseHoney *= Population;
					
					Honey += baseHoney;
					m_LastGrowth = HiveGrowthIndicator.Grown;
				}

				potAgility = 0;

				if( Population < 10 && !( ScaleFlower()<ResourceStatus.Normal) && !(ScaleWater()<ResourceStatus.Normal) ) 
				{
					m_LastGrowth = HiveGrowthIndicator.PopulationUp;
					Population++;
				}
			}

			if( HiveStage >= HiveStatus.Producing && !m_Bees.Visible )
				m_Bees.Visible = true;
		}
Exemple #5
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			m_Bees = (apiBeesComponent)reader.ReadItem();  //for displaying bee swarm
			m_Health = reader.ReadInt();  //current health
			m_NextCheck = reader.ReadDateTime();	//next update check
			m_Status = (HiveStatus)reader.ReadInt();  //growth stage
			m_LastGrowth = (HiveGrowthIndicator)reader.ReadInt();  //last growth
			m_Age = reader.ReadInt();  //age of hive
			m_Population = reader.ReadInt();  //bee population (*10k)
			m_Parasite = reader.ReadInt();  //parasite level(0, 1, 2)
			m_Disease = reader.ReadInt();  //disease level (0, 1, 2)
			m_Flowers = reader.ReadInt();  //amount of water tiles in range (during last check)
			m_Water = reader.ReadInt();	 //number of flowers in range (during last check)
			m_Wax = reader.ReadInt();  //amount of Wax
			m_Honey = reader.ReadInt();  //amount of Honey
			m_PotAgility = reader.ReadInt();  //number of agility potions
			m_PotHeal = reader.ReadInt();  //number of heal potions
			m_PotCure = reader.ReadInt();  //number of cure potions
			m_PotStr = reader.ReadInt();  //number of stength potions
			m_PotPoison = reader.ReadInt();  //number of poison potions
			m_Comp = (apiBeeHiveComponent)reader.ReadItem();  //for storing the top of the hive

		}
Exemple #6
0
        public void Grow()
        {
            if (OverallHealth < HiveHealth.Healthy)
            {                                                           //not healthy enough to grow or produce
                if (m_LastGrowth != HiveGrowthIndicator.PopulationDown) //population down takes precedence
                {
                    m_LastGrowth = HiveGrowthIndicator.NotHealthy;
                }
            }
            else if (ScaleFlower() < ResourceStatus.Low || ScaleWater() < ResourceStatus.Low)
            {                                                           //resources too low to grow or produce
                if (m_LastGrowth != HiveGrowthIndicator.PopulationDown) //population down takes precedence
                {
                    m_LastGrowth = HiveGrowthIndicator.LowResources;
                }
            }
            else if (HiveStage < HiveStatus.Stage5)
            {            //not producing yet, so just grow
                int curStage = (int)HiveStage;
                HiveStage = (HiveStatus)(curStage + 1);

                m_LastGrowth = HiveGrowthIndicator.Grown;
            }
            else
            {
                //production
                if (Wax < MaxWax)
                {
                    int baseWax = 1;

                    if (this.OverallHealth == HiveHealth.Thriving)
                    {
                        baseWax++;
                    }

                    baseWax += potAgility;                     //bees work harder

                    baseWax *= Population;

                    if (LessWax)
                    {
                        baseWax = Math.Max(1, (baseWax / 3));                           //wax production is slower then honey
                    }
                    Wax         += baseWax;
                    m_LastGrowth = HiveGrowthIndicator.Grown;
                }

                if (Honey < MaxHoney)
                {
                    int baseHoney = 1;

                    if (this.OverallHealth == HiveHealth.Thriving)
                    {
                        baseHoney++;
                    }

                    baseHoney += potAgility;                     //bees work harder

                    baseHoney *= Population;

                    Honey       += baseHoney;
                    m_LastGrowth = HiveGrowthIndicator.Grown;
                }

                potAgility = 0;

                if (Population < 10 && !(ScaleFlower() < ResourceStatus.Normal) && !(ScaleWater() < ResourceStatus.Normal))
                {
                    m_LastGrowth = HiveGrowthIndicator.PopulationUp;
                    Population++;
                }
            }

            if (HiveStage >= HiveStatus.Producing && !m_Bees.Visible)
            {
                m_Bees.Visible = true;
            }
        }