Is there any kind of tutorials or sites with info on how to make a simple City Builder game in Unity3d?
Well, the way I would do this, is that you have a variable for your money.
You have a bunch of buttons for each building type, when a building button is clicked, you check the players money.
If the player’s money >= buildingPrice then money -= buildingPrice.
From there I would set a variable like,
building = true
and another variable, like,
Skyscraper = true.
Then you can have an if for when the mouse button is down and do
if building = true Skyscraper == true then createBuilding(hit.point)
Of course, this isn’t the actual code, but it is real easy to figure out once you look at a few examples:
Here is how I make a player summon walls, based on their cursor position:
if(Physics.Raycast(ray, out hit) hit.transform != this.transform)
{
GameObject wall = Instantiate(wallPrefab, hit.point, Quaternion.identity) as GameObject;
}
You can also check if there is a building already there, or in a certain distance of the building by using a Physics.OverlapSphere
For roads, there is a plugin for Unity that allows roads to be made in the editor (if I remember correctly at least…), I’m sure there is a way to create them at runtime.
I hope I helped, I don’t actually have enough time to write up a full tutorial for you. You can talk to me on MSN or AIM, and I should be able to find the time to help you at some point.
Good luck on your game, I’m a fan of city builder type games!