public MoveResult TryMove(Direction direction, int warriorIndex) { Square <Warrior> warriorSquare = _warriorSquares[warriorIndex]; int newRow = warriorSquare.Row + direction.DeltaRow; int newCol = warriorSquare.Col + direction.DeltaCol; if (OutsideGrid(newRow, newCol)) { return(MoveResult.InvalidDirection); } _grid[warriorSquare.Row, warriorSquare.Col].GameObject = null; Warrior warrior = warriorSquare.GameObject; warrior.RemainingMoves--; GameObject newCellGameObject = _grid[newRow, newCol].GameObject; Fruit fruit = newCellGameObject as Fruit; if (newCellGameObject == null || fruit != null) { if (fruit != null) { warrior.Eat(fruit); } _grid[newRow, newCol].GameObject = warrior; warriorSquare.Row = newRow; warriorSquare.Col = newCol; return(warrior.RemainingMoves > 0 ? MoveResult.MoreMoves : MoveResult.NoMoreMoves); } Warrior otherWarrior = (Warrior)newCellGameObject; int clashResult = warrior.ClashWith(otherWarrior); if (clashResult == 0) { _grid[newRow, newCol].GameObject = new Draw(); } else { Warrior winner = clashResult > 0 ? warrior : otherWarrior; winner.IsWinner = true; _grid[newRow, newCol].GameObject = winner; } warriorSquare.Row = newRow; warriorSquare.Col = newCol; return(clashResult == 0 ? MoveResult.DrawnBattle : MoveResult.Battle); }