Example #1
0
        public override void Process()
        {
            --TimeToReproduce;

            Coordinate coordinate = Ocean.GetSpecificNeighborCoordinate <Cell>(this);

            if (!coordinate.Equals(Coordinate))
            {
                if (TimeToReproduce <= 0)
                {
                    TimeToReproduce = DefaultTimeToReproduce;
                    Cell child = Reproduce();

                    Ocean.MoveCell(this, coordinate);
                    Ocean.AddCell(child);
                }
                else
                {
                    Ocean.MoveCell(this, coordinate);
                }
            }
        }
Example #2
0
        public override void Process()
        {
            --TimeToFeed;

            if (TimeToFeed <= 0)
            {
                Ocean.RemoveCellAt(Coordinate);
            }
            else
            {
                Coordinate toCoordinate = Ocean.GetSpecificNeighborCoordinate <Prey>(this);
                if (!toCoordinate.Equals(Coordinate))
                {
                    TimeToFeed = DefaultTimeToFeed;

                    Ocean.RemoveCellAt(toCoordinate);
                    Ocean.MoveCell(this, toCoordinate);
                }
                else
                {
                    base.Process();
                }
            }
        }