Exemple #1
0
        /// <summary>
        ///  Initializes a new state object with the given position and family generation
        /// </summary>
        /// <param name="position">The position of the new PlantState</param>
        /// <param name="generation">The family generation of the new Plant</param>
        /// <returns>A state object initialized to the given position and generation.</returns>
        public override OrganismState InitializeNewState(Point position, int generation)
        {
            // Need to start out hungry so they can't reproduce immediately and just populate the world
            var initialEnergy = EnergyState.Hungry;

            var newState = new PlantState(Guid.NewGuid().ToString(), this, generation, initialEnergy, InitialRadius)
            {
                Position = position
            };

            newState.ResetGrowthWait();
            return(newState);
        }