How can I merge C# program and Unity3D?

Hello, guys!!

First of all, I’d like to apologize about my bad English. Because I’m from South Korea.
I can’t speak English well. So, if you have a little bit of patience for considering my question and grammar, I’ll appreciate your help very much. :slight_smile:

This is my situation. I have a project developing a game.(This game is traditional board game in South Korea name is ‘YUT-NO-RI’.)

This game is quite complex. But I think “What kind of this game?” is not important. Developing algorithm is complete.

Then, I got a problem from next step. Total algoritm is finished by C# object-oriented programming(in Console). And I’ve found all kind of action in Unity3D(for example, how to move my Avatar, Camera moving, rigidbody, etc).

But I have no idea how to merge(merge? combine?) C# program and Unity3D.
So, if you give me some advice or information about how to merge C# program and Unity3D, I’ll be very delighted.

Below is my C# program code.

--DEFINITIONS of other classes--


    class Program // main algorithm class for playing game
        {
            static void Main(string[] args)
            {
                gameManager game = new gameManager();
    
                while (true)
                {
                    Console.WriteLine(game.getTeam() + "Team's turn.");
                    Console.WriteLine(game.getPlayer() + "player's turn to throw YUT.");
    
                    while (true)
                    {
                        game.throwYut();
                        if (game.firstBack() == true || game.getYut() == 0)
                            break;
    
                        else if (
                            game.getYut() == 1 || game.getYut() == 2 ||
                            game.getYut() == 3 || game.getYut() == 6)
                        {
                            game.setYutList(game.getYut());
                            break;
                        }
                        game.setYutList(game.getYut());/
                    }
                    if (game.firstBack() == true || game.getYut() == 0)
                    {
                        game.changeTeam();
                        game.changePlayer();
                        continue;
                    }
    
                    while (0 < game.getYutListCount())
                    {
                        game.selectYut();
                        game.selectHorse();
    
                        int max = 0;
                        if (game.getYut() == 6)
                            max = 1;
                        else
                            max = game.getYut();
    
                        for (int i = 0; i < max; i++)
                            game.moveHorse();
    
                        // Path Recording
                        game.setHorsePathList();
    
                        // Branch.
                        game.branch();
                        if (game.victory())
                            break;
    
                        // Kill or add
                        if (game.arrivalHorse())
                        {
                            Console.WriteLine("Kill enemy.");
                            // throw YUT one more time.
                            while (true)
                            {
                                game.throwYut();
                                if (game.firstBack() == true || game.getYut() == 0)
                                    break;
    
                                else if (
                                    game.getYut() == 1 || game.getYut() == 2 ||
                                    game.getYut() == 3 || game.getYut() == 6)
                                {
                                    game.setYutList(game.getYut());
                                    break;
                                }
                                game.setYutList(game.getYut());
                            }
                            if (game.firstBack() == true || game.getYut() == 0)
                            {
                                continue;
                            }
                        }
                        // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
                        game.printBoard();
                        // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
                    }
                    if (game.victory())
                        return;
    
                    game.changeTeam();
                    game.changePlayer();
                    game.clearHorsePathList();
                }
            }
        }

That’s not going to happen. What you asking in one answer is how to teach you to use Unity and C#.

You’ll need to spend a few weeks doing some tutorials and mastering the basics. Once you have done that you’ll have a very good idea how to make your C# code work into a Unity game.

Good luck.

You should be able to put your custom classes in a C# class library (.dll) and import that into Unity: Including a DLL in unity? - Questions & Answers - Unity Discussions

However, your game loop and things like that won’t directly translate into Unity. You’ll need to use Unity by doing some tutorials and reading documentation.