Пример #1
0
        private void MakeTurn(Creature simpleCreature, int[,] eat, int i, int j)
        {
            if (simpleCreature == null) return;

            var resultTuple = simpleCreature.MyTurn(eat, Cells);

            var result = resultTuple.Item2;

            if (resultTuple.Item1)
            {
                var newPosition = ActionEx.PointByAction(result, new Point(i, j), Cells);

                Cells[newPosition.X, newPosition.Y] = simpleCreature.MakeChild(newPosition);

                return;
            }

            if (result == ActionEnum.Stay) return;
            if (result == ActionEnum.Die) Cells[i, j] = null;
            else
            {
                var newPosition = ActionEx.PointByAction(result, new Point(i, j), Cells);
                simpleCreature.SetPosition(newPosition);
                Cells[i, j] = null;
                Cells[newPosition.X, newPosition.Y] = simpleCreature;
            }
        }