Ejemplo n.º 1
0
        /// <summary>
        ///  Initializes a new state given a position and a generation.  This is
        ///  used when creatures give birth, and the state has to effectively
        ///  be cloned.
        /// </summary>
        /// <param name="position">The new position of the creature in the world.</param>
        /// <param name="generation">The family generation for this creature.</param>
        /// <returns>A new state to represent the creature.</returns>
        public override OrganismState InitializeNewState(Point position, int generation)
        {
            AnimalState newState = new AnimalState(Guid.NewGuid().ToString(), this, generation);
            newState.Position = position;
            newState.IncreaseRadiusTo(InitialRadius);

            // Need to start out hungry so they can't reproduce immediately and just populate the world
            newState.StoredEnergy = newState.UpperBoundaryForEnergyState(EnergyState.Hungry);
            newState.ResetGrowthWait();

            return newState;
        }