Example #1
0
        private void makeNextGenAnimal(InitialAnimalAttributes inIAA, DateTime currTime)
        {
            Animal tmpAnimal = null;

            mLog.Debug("inside make next gen animal");
            try
            {
                for (int i = 0; i < inIAA.NumToMake; i++)
                {
                    if (inIAA.Sex == 'M')
                    {
                        mLog.Debug("makeing a new male");
                        tmpAnimal = new Male();
                        tmpAnimal.GenderModifier = this.mMaleModifier;
                    }
                    else
                    {
                        mLog.Debug("makeing a new female");
                        tmpAnimal = new Female();
                        tmpAnimal.GenderModifier = this.mFemaleModifier;
                    }

                    tmpAnimal.IdNum = this.currNumAnimals++;
                    mLog.Debug("just made " + tmpAnimal.IdNum.ToString());
                    tmpAnimal.Location        = inIAA.Location;
                    tmpAnimal.AnimalAtributes = this.AnimalAttributes;
                    tmpAnimal.CurrEnergy      = this.AnimalAttributes.InitialEnergy;
                    mLog.Debug("now setting the mover");
                    tmpAnimal.myMover          = this.mMover;
                    tmpAnimal.StateModifer     = this.SafeSearchMod;
                    tmpAnimal.AnimalManager    = this;
                    tmpAnimal.HomeRangeTrigger = this.mHomeRangeTrigger;
                    tmpAnimal.HomeRangeFinder  = this.mHomeRangeFinder;
                    tmpAnimal.setInitialSleepTime(currTime);
                    this.SetMapValues(tmpAnimal, currTime);
                    tmpAnimal.BuildTextWriter(currTime.Year.ToString());
                    tmpAnimal.dump();
                    this.myAnimals.Add(tmpAnimal);
                }
            }


            catch (System.Exception ex)
            {
#if (DEBUG)
                System.Windows.Forms.MessageBox.Show(ex.Message);
#endif
                eLog.Debug(ex);
            }
        }
Example #2
0
        public bool makeInitialAnimals(InitialAnimalAttributes[] inIAA)
        {
            bool success = true;

            Animal tmpAnimal;

            //fw.writeLine("inside make initial animals");
            try
            {
                //this is an array of attributes one of which is how many to make of this type
                for (int i = 0; i <= inIAA.Length - 1; i++)
                {
                    //so for each entity in the array we need to make j amount of animals
                    for (int j = 0; j < inIAA[i].NumToMake; j++)
                    {
                        if (inIAA[i].Sex == 'M')
                        {
                            //fw.writeLine("makeing a new male");
                            tmpAnimal = new Male();
                        }
                        else
                        {
                            mLog.Debug("makeing a new female");
                            tmpAnimal = new Female();
                        }

                        tmpAnimal.IdNum = this.currNumAnimals++;
                        mLog.Debug("just made " + tmpAnimal.IdNum.ToString());
                        tmpAnimal.Location = inIAA[i].Location;

                        tmpAnimal.AnimalAtributes = this.AnimalAttributes;
                        mLog.Debug("now setting the mover");
                        tmpAnimal.myMover       = this.mMover;
                        tmpAnimal.AnimalManager = this;
                        mLog.Debug("now adding to the list of my animals;");
                        this.myAnimals.Add(tmpAnimal);
                    }
                }
            }
            catch (System.Exception ex)
            {
                eLog.Debug(ex);
                mLog.Debug("");
                success = false;
            }
            return(success);
        }