- Home /
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. :)
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();
}
}
}
Answer by Dave-Carlile · Nov 21, 2012 at 07:09 PM
You should be able to put your custom classes in a C# class library (.dll) and import that into Unity: http://answers.unity3d.com/questions/333829/including-a-dll-in-unity.html
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.
Thanks for your comment. That information could be very helpful for me. Thank you!!
Answer by Meltdown · Nov 21, 2012 at 06:57 PM
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.
Thank you for giving me advice. That 'few weeks' word is making me sad. Because I have to finish this project within 1 week for graduating. I think I have to find another program. Anyway, thank you very much!
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
turn on off particle system 1 Answer
How do i start a game with Unity, what do i need first? 0 Answers