Exemplo n.º 1
0
 /// <summary>Clears the values of the properties of the domain class by using the default value for the type of each property (e.g '0' for numbers, 'the empty string' for strings, etc.)</summary>
 public virtual Boolean ClearValues()
 {
     _currentdate  = new DateTime();
     _cumulTT      = new List <double>();
     _DayLength    = default(System.Double);
     _DeltaTT      = default(System.Double);
     _GrainCumulTT = default(System.Double);
     _GAI          = default(System.Double);
     _IsLatestLeafInternodeLengthPotPositive = default(System.Int32);
     _Calendar                   = new Calendar();
     _LeafNumber                 = default(System.Double);
     _FinalLeafNumber            = default(System.Double);
     _phase_                     = new Phase();
     _Phyllochron                = default(System.Double);
     _Vernaprog                  = default(System.Double);
     _HasFlagLeafLiguleAppeared  = default(System.Int32);
     _MinFinalNumber             = default(System.Double);
     _hasLastPrimordiumAppeared  = default(System.Int32);
     _isMomentRegistredZC_39     = default(System.Int32);
     _cumulTTFromZC_39           = default(System.Double);
     _cumulTTFromZC_91           = default(System.Double);
     _cumulTTFromZC_65           = default(System.Double);
     _currentZadokStage          = default(System.Int32);
     _hasZadokStageChanged       = default(System.Int32);
     _tilleringProfile           = new List <double>();
     _leafTillerNumberArray      = new List <double>();
     _CanopyShootNumber          = default(System.Double);
     _AverageShootNumberPerPlant = default(System.Double);
     _TillerNumber               = default(System.Int32);
     _Ntip = default(System.Double);
     _cumulTTPhenoMaizeAtEmergence = default(System.Double);
     // Returns true if everything is ok
     return(true);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (FarmId != null)
         {
             hashCode = hashCode * 59 + FarmId.GetHashCode();
         }
         if (Date != null)
         {
             hashCode = hashCode * 59 + Date.GetHashCode();
         }
         if (Plant != null)
         {
             hashCode = hashCode * 59 + Plant.GetHashCode();
         }
         if (GrowthStage != null)
         {
             hashCode = hashCode * 59 + GrowthStage.GetHashCode();
         }
         if (Answer != null)
         {
             hashCode = hashCode * 59 + Answer.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemplo n.º 3
0
        private void PrintNormalRunDate(PageData page, Run runOld, GrowthStage moment)
        {
            var lastUniverse = GetLastUniverse(runOld);

            if (lastUniverse != null)
            {
                DateTime?momentDate = lastUniverse.Crop_.getDateOfStage(moment);

                ///<Behnam (2015.09.18)>
                ///<Comment>
                ///Previously it was required to subtract one day to report model state variables at specific
                ///growth stages, except ZC_00_Sowing and ZC_39_FlagLeafLiguleJustVisible.
                ///By this modification, the model stores the dates correctly and they need not to be changed
                ///when reporting or when retrieving their values.
                ///</Comment>


                ///</Behnam>

                if (momentDate != null)
                {
                    page.NewLine().AddDateDOY(momentDate).Add(Phase.growthStageAsString(moment));
                }
                else
                {
                    page.NewLine().AddDateDOY(null).Add(Phase.growthStageAsString(moment));
                }
            }
            else
            {
                page.NewLine().AddDateDOY(null).Add(Phase.growthStageAsString(moment));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns true if Plant instances are equal
        /// </summary>
        /// <param name="other">Instance of Plant to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Plant other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     GrowthStage == other.GrowthStage ||
                     GrowthStage != null &&
                     GrowthStage.Equals(other.GrowthStage)
                 ) &&
                 (
                     Ko == other.Ko ||
                     Ko != null &&
                     Ko.Equals(other.Ko)
                 ));
        }
Exemplo n.º 5
0
        private void PrintMultiRunSummaryDate(LineData line, Run runOld, GrowthStage moment)
        {
            var lastUniverse = GetLastUniverse(runOld);

            if (lastUniverse != null)
            {
                // pm 29 April 2015: need to remove 1 day to report the growth stage on the day
                //                   they were simulated
                var momentDate = lastUniverse.Crop_.getDateOfStage(moment);

                ///<Behnam (2015.09.18)>
                ///<Comment>
                ///Previously it was required to subtract one day to report model state variables at specific
                ///growth stages, except ZC_00_Sowing and ZC_39_FlagLeafLiguleJustVisible.
                ///By this modification, the model stores the dates correctly and they need not to be changed
                ///when reporting or when retrieving their values.
                ///</Comment>

                // if (lastUniverse.Crop_.calendar[moment].HasValue && moment != GrowthStage.ZC_00_Sowing &&
                // moment != GrowthStage.ZC_39_FlagLeafLiguleJustVisible)
                // {
                // momentDate = lastUniverse.Crop_.calendar[moment].Value.AddDays(-1);
                // }

                ///</Behnam>

                line.Add(momentDate.HasValue ? momentDate.Value.ToString("yyyy-MM-dd") : "?");
            }
            else
            {
                line.Add("?");
            }
        }
Exemplo n.º 6
0
 ///<summary>Get the cumul thermal time from beginning of the simulation to a moment</summary>
 ///<param name="cumulField">The type of thermal time to get.</param>
 ///<param name="to">The moment to stop cumul.</param>
 ///<returns>The cumul of thermal times from the beginning of the simulation to the day of the specified moment.</returns>
 private double thermalTimeFromBeginning(int cumulField, GrowthStage to)
 {
     if (IsMomentRegistred(to) == 1)
     {
         return(CumulTTOf(to)[(int)cumulField]);
     }
     throw new ArgumentException("the moment " + to + " is not yet registred.");
 }
Exemplo n.º 7
0
 private static double thermalTimeFromBeginning(int cumulField, GrowthStage to, Dictionary <GrowthStage, Dictionary <DateTime, double> > calendarMoments)
 {
     if (IsMomentRegistred(to, calendarMoments) == 1)
     {
         return(CumulTTOf(to, calendarMoments));
     }
     throw new ArgumentException("the moment " + to + " is not yet registred.");
 }
Exemplo n.º 8
0
        private void OnDoPhenology(object sender, EventArgs e)
        {
            if (PlantIsAlive)
            {
                // If this is the first time through here then setup some variables.
                if (Phases == null || Phases.Count == 0)
                {
                    OnSimulationCommencing(null, null);
                }

                CurrentlyOnFirstDayOfPhase = "";
                if (JustInitialised)
                {
                    CurrentlyOnFirstDayOfPhase = Phases[0].Start;
                    JustInitialised            = false;
                }
                double FractionOfDayLeftOver = CurrentPhase.DoTimeStep(1.0);

                if (FractionOfDayLeftOver > 0)
                {
                    // Transition to the next phase.
                    if (CurrentPhaseIndex + 1 >= Phases.Count)
                    {
                        throw new Exception("Cannot transition to the next phase. No more phases exist");
                    }

                    if (CurrentPhase is EmergingPhase)
                    {
                        Emerged = true;
                    }

                    CurrentPhase = Phases[CurrentPhaseIndex + 1];
                    if (GrowthStage != null)
                    {
                        GrowthStage.Invoke();
                    }


                    // Tell the new phase to use the fraction of day left.
                    FractionOfDayLeftOver = CurrentPhase.AddTT(FractionOfDayLeftOver);
                    Stage = CurrentPhaseIndex + 1;
                }
                else
                {
                    Stage = (CurrentPhaseIndex + 1) + CurrentPhase.FractionComplete;
                }

                _AccumulatedTT += CurrentPhase.TTForToday;

                if (Emerged && PostPhenology != null)
                {
                    PostPhenology.Invoke(this, new EventArgs());
                }

                Util.Debug("Phenology.CurrentPhaseName=%s", CurrentPhase.Name.ToLower());
                Util.Debug("Phenology.CurrentStage=%f", Stage);
            }
        }
Exemplo n.º 9
0
 void SeedGerminated()
 {
     GetMeshRenderer().enabled = User.Instance.GetRenderWorldUserPref();
     stage = GrowthStage.Germinating;
     for (int i = 0; i < organs.Count; i++)
     {
         organs[i].OnOrganismGermination();
     }
 }
Exemplo n.º 10
0
 public void SpawnAnimalRandom()
 {
     age   = UnityEngine.Random.Range(reproductive.animalSpeciesReproductive.reproductionAge / 2, animalSpecies.maxAge / 1.2f);
     stage = GrowthStage.Juvinile;
     ManageAge();
     health = animalSpecies.maxHealth;
     food   = UnityEngine.Random.Range(animalSpecies.fullFood, animalSpecies.maxFood);
     reproductive.SpawnReproductive();
 }
Exemplo n.º 11
0
        ///<summary>
        ///Register a moment.
        ///</summary>
        ///<param name="moment">The moment.</param>
        ///<param name="theDate">The date when the moment appeared.</param>
        public void Set(GrowthStage moment, DateTime theDate, List <double> cumulTT)
        {
            if (moment == GrowthStage.ZC_00_Sowing)
            {
                calendarMoments.Clear();
            }

            LastGrowthStageSet = moment;
            calendarMoments.Add(moment, new CalendarDailyInfo(theDate, cumulTT));
        }
Exemplo n.º 12
0
 public void SpawnPlantRandom(GrowthStage stage)
 {
     this.stage = stage;
     age        = 0;
     CheckRendering();
     for (int i = 0; i < organs.Count; i++)
     {
         organs[i].SpawnOrganismAdult();
     }
 }
Exemplo n.º 13
0
 public void SpawnAnimal(AnimalScript parent)
 {
     this.parent = parent;
     age         = 0;
     stage       = GrowthStage.Juvinile;
     zone        = parent.zone;
     health      = animalSpecies.maxHealth;
     food        = UnityEngine.Random.Range(animalSpecies.fullFood / 2, animalSpecies.fullFood);
     reproductive.SpawnReproductive();
 }
Exemplo n.º 14
0
        public static string growthStageAsString(GrowthStage moment)
        {
            switch (moment)
            {
            case GrowthStage.BeginningStemExtension: return("Beginning stem extension");

            case GrowthStage.ZC_75_EndCellDivision: return("End cell division");

            case GrowthStage.ZC_91_EndGrainFilling: return("End grain filling");

            default: return(moment.ToString());
            }
        }
Exemplo n.º 15
0
 internal override void OrganismDied()
 {
     animalSpecies.SpawnCorpse(this);
     stage = GrowthStage.Corpse;
     food  = animalSpecies.bodyWeight * (food / animalSpecies.fullFood + 1);
     age   = animalSpecies.deteriationTime;
     if (mate != null)
     {
         mate.mate = null;
         mate      = null;
     }
     GetMeshRenderer().material.color = animalSpecies.GetCorpseColor();
 }
Exemplo n.º 16
0
        public void SetDefault()
        {
            hornColor  = new Color(180, 140, 60);
            scaleColor = new Color(255, 50, 50);
            bellyColor = new Color(250, 220, 130);
            eyeColor   = new Color(100, 100, 220);

            name = "Draggy the Dragon";

            roar = Roar.normal;

            stage = GrowthStage.egg;
            gear  = null;
        }
Exemplo n.º 17
0
        public void Load(TagCompound tag)
        {
            hornColor  = tag.Get <Color>(nameof(hornColor));
            scaleColor = tag.Get <Color>(nameof(scaleColor));
            bellyColor = tag.Get <Color>(nameof(bellyColor));
            eyeColor   = tag.Get <Color>(nameof(eyeColor));

            name = tag.GetString(nameof(name));

            roar = (Roar)tag.GetInt(nameof(roar));

            stage = (GrowthStage)tag.GetInt(nameof(stage));
            gear  = tag.Get <Item>(nameof(gear));
        }
Exemplo n.º 18
0
 public PlantData(PlantScript plantScript)
 {
     age                  = plantScript.age;
     speciesIndex         = plantScript.species.speciesIndex;
     specificSpeciesIndex = plantScript.species.specificSpeciesIndex;
     plantIndex           = plantScript.specificOrganismIndex;
     zone                 = plantScript.zone;
     position             = plantScript.position;
     bladeArea            = plantScript.bladeArea;
     stemHeight           = plantScript.stemHeight;
     rootGrowth           = plantScript.rootGrowth;
     rootDensity          = .1f;
     stage                = plantScript.stage;
 }
Exemplo n.º 19
0
 public void ResetAnimal()
 {
     stage = GrowthStage.Dead;
     SetOrganismZone(-1);
     age    = 0;
     food   = 0;
     health = 0;
     for (int i = 0; i < organs.Count; i++)
     {
         organs[i].ResetOrgan();
     }
     GetEarthScript().GetZoneController().allAnimals[animalDataIndex] = new AnimalData(this);
     GetMeshRenderer().material.color = species.speciesColor;
 }
Exemplo n.º 20
0
 public void ResetPlant()
 {
     stage      = GrowthStage.Dead;
     zone       = -1;
     growth     = 0;
     age        = 0;
     bladeArea  = 0;
     stemHeight = 0;
     rootGrowth = new float2(0, 0);
     for (int i = 0; i < organs.Count; i++)
     {
         organs[i].ResetOrgan();
     }
     GetEarthScript().GetZoneController().allPlants[plantDataIndex] = new PlantData(this);
 }
Exemplo n.º 21
0
        public static Universe GetUniverse(Run runOld, GrowthStage moment)
        {
            DateTime?momentDate     = null;
            Universe momentUniverse = null;
            var      lastUniverse   = GetLastUniverse(runOld);

            if (lastUniverse != null)
            {
                momentDate = lastUniverse.Crop_.getDateOfStage(moment);
            }
            if (momentDate.HasValue)
            {
                momentUniverse = runOld.GetUniverse(momentDate.Value);
            }
            return(momentUniverse);
        }
Exemplo n.º 22
0
 public AnimalData(AnimalScript animal)
 {
     age                     = animal.age;
     speciesIndex            = animal.species.speciesIndex;
     specificSpeciesIndex    = animal.species.specificSpeciesIndex;
     animalIndex             = animal.specificOrganismIndex;
     position                = animal.position;
     zone                    = animal.zone;
     animalEyePosition       = GetAnimalEyePositions(animal, animal.GetEyes());
     animalMouthPosition     = GetMouthPosition(animal, animal.GetMouth());
     animalFood              = animal.food;
     animalSex               = animal.GetReproductive().GetSex();
     animalHasMate           = AnimalHasMate(animal);
     animalReproductionReady = ReadyToReproduce(animal);
     stage                   = animal.stage;
 }
Exemplo n.º 23
0
    public void TimeStep()
    {
        GrowthStage stage = (GrowthStage)DataDump.Get <int>("LocalPetGrowthStage");

        switch (stage)
        {
        case GrowthStage.Baby:
        case GrowthStage.Juvi:
            int fullness = DataDump.Get <int>("LocalPetFullness") - 1;
            if (fullness <= 0)
            {
                // go to the die
                StartCoroutine(Die());
                MessageController.AddMessage("oof");
                MessageController.AddMessage("it starved to death");
                MessageController.AddMessage("gather the food that's laying around");
                MessageController.AddMessage("make sure to click the pet");
                MessageController.AddMessage("and then the type of food");
                MessageController.AddMessage("it will be dead for a minute..");
                MessageController.AddMessage("but it always comes back");
                return;
            }
            if (fullness == FullnessTolerance / 2)
            {
                // go to the complain
                MessageController.AddMessage("it's getting hungry..");
            }
            if (fullness == 3)
            {
                // go to the complain
                MessageController.AddMessage("it's about to starve!");
            }
            DataDump.Set("LocalPetFullness", fullness);
            break;
        }

        if (stage == GrowthStage.Baby && DataDump.Get <int>("LocalPetNextGrowthTime") < CurrentTime)
        {
            // go to the grow
            StartCoroutine(Grow());
        }

        if (stage == GrowthStage.Dead && DataDump.Get <int>("LocalPetNextGrowthTime") < CurrentTime)
        {
            StartCoroutine(Sprout());
        }
    }
Exemplo n.º 24
0
        public Plant(int seconds, GrowthStage stage, int x, int y) : base(x, y, 20)
        {
            SeedSize      = 20;
            JuvenilleSize = 20;
            AdultSize     = 20;

            Size = GetSize();
            CollisionDistance = Size / 2;

            Action        = null;
            growthSeconds = seconds;
            GrowthStage   = stage;
            if (GrowthStage != GrowthStage.Adult)
            {
                base.OnScheduleEvent(this, new ScheduleEventArgs(growthSeconds, new GrowAction()));
            }
        }
Exemplo n.º 25
0
 bool ManageAge()
 {
     age += GetEarthScript().simulationDeltaTime;
     if (stage == GrowthStage.Juvinile && reproductive.IsMature())
     {
         stage = GrowthStage.Adult;
     }
     if (age >= animalSpecies.maxAge)
     {
         health = 0;
         if (CheckIfDead("Age"))
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 26
0
 /// <summary>copy constructor</summary>
 public PhenologyState(PhenologyState toCopy, bool copyAll)
 {
     _parametersIO = new ParametersIO(this);
     _phase_       = (toCopy._phase_ != null) ? new Phase(toCopy._phase_) : null;
     _Calendar     = (toCopy._Calendar != null) ? new Calendar(toCopy._Calendar) : null;
     _currentdate  = toCopy._currentdate;
     _cumulTT      = toCopy._cumulTT;
     _DayLength    = toCopy._DayLength;
     _DeltaTT      = toCopy._DeltaTT;
     _GrainCumulTT = toCopy._GrainCumulTT;
     _GAI          = toCopy._GAI;
     _LeafNumber   = toCopy._LeafNumber;
     //_TagPhenoWarnOut = toCopy._TagPhenoWarnOut;
     _FinalLeafNumber            = toCopy._FinalLeafNumber;
     _Phyllochron                = toCopy._Phyllochron;
     _Vernaprog                  = toCopy._Vernaprog;
     _currentZadokStage          = toCopy._currentZadokStage;
     _CanopyShootNumber          = toCopy._CanopyShootNumber;
     _TillerNumber               = toCopy._TillerNumber;
     _AverageShootNumberPerPlant = toCopy._AverageShootNumberPerPlant;
     tilleringProfile            = new List <double>();
     for (int i = 0; i < toCopy.tilleringProfile.Count; i++)
     {
         tilleringProfile.Add(toCopy.tilleringProfile[i]);
     }
     leafTillerNumberArray = new List <double>();
     for (int i = 0; i < toCopy.leafTillerNumberArray.Count; i++)
     {
         leafTillerNumberArray.Add(toCopy.leafTillerNumberArray[i]);
     }
     if (copyAll)
     {
         _Ntip = toCopy._Ntip;
         _hasLastPrimordiumAppeared = toCopy._hasLastPrimordiumAppeared;
         _isMomentRegistredZC_39    = toCopy._isMomentRegistredZC_39;
         _cumulTTFromZC_39          = toCopy._cumulTTFromZC_39;
         _cumulTTFromZC_91          = toCopy._cumulTTFromZC_91;
         _cumulTTFromZC_65          = toCopy._cumulTTFromZC_65;
         _IsLatestLeafInternodeLengthPotPositive = toCopy._IsLatestLeafInternodeLengthPotPositive;
         _HasFlagLeafLiguleAppeared    = toCopy._HasFlagLeafLiguleAppeared;
         _MinFinalNumber               = toCopy._MinFinalNumber;
         _cumulTTPhenoMaizeAtEmergence = toCopy._cumulTTPhenoMaizeAtEmergence;
         _hasZadokStageChanged         = toCopy._hasZadokStageChanged;
     }
 }
Exemplo n.º 27
0
    /// <summary>
    /// Perform our daily timestep function. Get the current phase to do its
    /// development for the day. If TT is leftover after Phase is progressed,
    /// and the timestep for the subsequent phase is calculated using leftover TT
    /// </summary>
    public void DoTimeStep()
    {
        // If this is the first time through here then setup some variables.
        if (Phases == null || Phases.Count == 0)
        {
            OnInitialised();
        }

        CurrentlyOnFirstDayOfPhase = "";
        if (JustInitialised)
        {
            CurrentlyOnFirstDayOfPhase = Phases[0].Start;
            JustInitialised            = false;
        }
        double FractionOfDayLeftOver = CurrentPhase.DoTimeStep(1.0);

        if (FractionOfDayLeftOver > 0)
        {
            // Transition to the next phase.
            if (CurrentPhaseIndex + 1 >= Phases.Count)
            {
                throw new Exception("Cannot transition to the next phase. No more phases exist");
            }

            CurrentPhase = Phases[CurrentPhaseIndex + 1];

            if (GrowthStage != null)
            {
                GrowthStage.Invoke();
            }

            // Tell the new phase to use the fraction of day left.
            FractionOfDayLeftOver = CurrentPhase.AddTT(FractionOfDayLeftOver);
            Stage = CurrentPhaseIndex + 1;
        }
        else
        {
            Stage = (CurrentPhaseIndex + 1) + CurrentPhase.FractionComplete;
        }

        _AccumulatedTT += CurrentPhase.TTForToday;
        Util.Debug("Phenology.CurrentPhaseName=%s", CurrentPhase.Name.ToLower());
        Util.Debug("Phenology.CurrentStage=%f", Stage);
    }
Exemplo n.º 28
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (GrowthStage != null)
         {
             hashCode = hashCode * 59 + GrowthStage.GetHashCode();
         }
         if (Ko != null)
         {
             hashCode = hashCode * 59 + Ko.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemplo n.º 29
0
        /// <summary>
        /// Returns true if SendSurveyData instances are equal
        /// </summary>
        /// <param name="other">Instance of SendSurveyData to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(SendSurveyData other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     FarmId == other.FarmId ||
                     FarmId != null &&
                     FarmId.Equals(other.FarmId)
                     ) &&
                 (
                     Date == other.Date ||
                     Date != null &&
                     Date.Equals(other.Date)
                 ) &&
                 (
                     Plant == other.Plant ||
                     Plant != null &&
                     Plant.Equals(other.Plant)
                 ) &&
                 (
                     GrowthStage == other.GrowthStage ||
                     GrowthStage != null &&
                     GrowthStage.Equals(other.GrowthStage)
                 ) &&
                 (
                     Answer == other.Answer ||
                     Answer != null &&
                     Answer.SequenceEqual(other.Answer)
                 ));
        }
Exemplo n.º 30
0
 public void UpdateOrganismBehavior(float sunGain, float waterGain, GrowthStage stage)
 {
     if (!spawned)
     {
         return;
     }
     if (this.stage == GrowthStage.Seed)
     {
         if (stage == GrowthStage.Dead)
         {
             KillOrganism();
             return;
         }
         if (stage == GrowthStage.Germinating)
         {
             SeedGerminated();
             return;
         }
         return;
     }
     this.stage = stage;
     growth     = GetEarthScript().simulationDeltaTime *Mathf.Sqrt(sunGain * waterGain);
     UpdateGrowthPriority();
 }
Exemplo n.º 31
0
 // Use this for initialization
 void Awake()
 {
     if (_instance != null) {
         _instance.returning = true;
         return;
     }
     _instance = this;
     DontDestroyOnLoad(transform.gameObject);
     DontDestroyOnLoad(GameObject.FindGameObjectWithTag("GregorEvol1"));
     DontDestroyOnLoad(GameObject.FindGameObjectWithTag("GregorEvol2"));
     DontDestroyOnLoad(GameObject.FindGameObjectWithTag("GregorEvol3"));
     m_xLocation = 0;
     m_yLocation = 0;
     m_defLevel = 0;
     m_strongLevel = 0;
     m_brainsLevel = 0;
     m_growth = GrowthStage.BABY;
     m_keyCount = 0;
     m_levelThreshold = 2;
     m_level = 0;
     m_xp = 0;
     evolChoices = new ArrayList(1);
     healthPoints = 20;
 }
Exemplo n.º 32
0
 public void grantXP(int xp)
 {
     m_xp += xp;
     if (m_xp > 99) m_xp = 99;
     updateXP();
     //Debug.Log(string.Format("Adding {0} xp", xp));
     if (m_xp > m_levelThreshold) {
         //Debug.LogWarning("Leveling Up!");
         hide();
         m_level++;
         if (m_level == 4) {
             m_growth = GrowthStage.TEEN;
             startNewPhase();
         }
         if (m_level == 8) {
             m_growth = GrowthStage.ADULT;
             startNewPhase();
         }
         m_levelThreshold += m_level+1;
         Application.LoadLevel("evolveScene");
     }
 }