Esempio n. 1
0
        private void PerformMating(Field <IAnimal> field)
        {
            if (_roundsLeftUntilBirth <= 0)
            {
                var cellBetweenParents = _vectorMath.DivideByNumber(Position + _matingTarget.Position, 2);
                GibBirth(new BirthEventArgs(cellBetweenParents));
                _roundsLeftUntilBirth = ROUNDS_TO_REPRODUCE;
            }

            if (_matingTarget != null && MateStillAround(field))
            {
                _roundsLeftUntilBirth--;
            }
            else
            {
                _matingTarget         = FindNewMate(field);
                _roundsLeftUntilBirth = ROUNDS_TO_REPRODUCE;
            }
        }