Skip to content
Snippets Groups Projects
Commit a635c322 authored by Erno Lokkila's avatar Erno Lokkila
Browse files

Ground generator not generates first worker correctly

parent 78979683
No related branches found
No related tags found
No related merge requests found
...@@ -13,8 +13,6 @@ public class GroundGenerator : MonoBehaviour ...@@ -13,8 +13,6 @@ public class GroundGenerator : MonoBehaviour
private GameObject[] resourceGOs = null; private GameObject[] resourceGOs = null;
[SerializeField] [SerializeField]
private GameObject homeGO = null; private GameObject homeGO = null;
[SerializeField]
private GameObject workerGO = null;
private int food = 2; private int food = 2;
private int stone = 3; private int stone = 3;
...@@ -63,15 +61,15 @@ public class GroundGenerator : MonoBehaviour ...@@ -63,15 +61,15 @@ public class GroundGenerator : MonoBehaviour
if (Random.value < 0.10f) if (Random.value < 0.10f)
{ {
ground[x, y] = 2; ground[x, y] = wood;
} }
if (Random.value < 0.10f) if (Random.value < 0.10f)
{ {
ground[x, y] = 3; ground[x, y] = stone;
} }
if (Random.value < 0.10f) if (Random.value < 0.10f)
{ {
ground[x, y] = 4; ground[x, y] = food;
} }
} }
void createGround() void createGround()
...@@ -150,8 +148,8 @@ public class GroundGenerator : MonoBehaviour ...@@ -150,8 +148,8 @@ public class GroundGenerator : MonoBehaviour
private void createHome() { private void createHome() {
ground[ground.GetLength(0) / 2, ground.GetLength(1) / 2] = home; ground[ground.GetLength(0) / 2, ground.GetLength(1) / 2] = home;
spawn(homeGO, houseCoords[0], houseCoords[1], houseDepth); GameObject go = spawn(homeGO, houseCoords[0], houseCoords[1], houseDepth);
homeGO.GetComponent<City>().AddCollector(); go.GetComponent<City>().AddCollector();
} }
private GameObject spawn(GameObject go, int x, int y, int z) { private GameObject spawn(GameObject go, int x, int y, int z) {
return Instantiate<GameObject>(go, new Vector3(x, y, z), Quaternion.identity); return Instantiate<GameObject>(go, new Vector3(x, y, z), Quaternion.identity);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment