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

Merge branch 'master' of gitlab.utu.fi:eolokk/game_jam19

parents 1d5a9d41 b39aeece
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,24 @@ using UnityEngine;
public class City : MonoBehaviour
{
[SerializeField]
GameObject worker;
[SerializeField]
public int population = 0;
[SerializeField]
public int populationLevel = 0;
[SerializeField]
public int resourcePoolLevel = 0;
[SerializeField]
public int roadLevel = 0;
[SerializeField]
public int collectorLevel = 0;
// Start is called before the first frame update
void Start()
......@@ -15,12 +32,30 @@ public class City : MonoBehaviour
public int GetLevel(UpgradeTargets target)
{
switch (target)
{
case UpgradeTargets.population:
return this.populationLevel;
case UpgradeTargets.capacity:
return this.resourcePoolLevel;
case UpgradeTargets.speed:
return this.roadLevel;
case UpgradeTargets.collector:
return this.collectorLevel;
default:
Debug.Log("Default");
return -1;
break;
}
return 1;
}
public void AddCollector()
{
GameObject go = Instantiate<GameObject>(worker);
go.transform.position = new Vector3();
}
......@@ -46,7 +81,7 @@ public class City : MonoBehaviour
public void AddPopulation(int v)
{
this.population += v;
}
......@@ -87,9 +122,15 @@ public class City : MonoBehaviour
{
lista[i].SetCapacity(x);
}
this.resourcePoolLevel++;
}
public void UseResources(List<int> a)
{
ResourcePool[] lista = gameObject.GetComponents<ResourcePool>();
for (int i = 0; i < lista.Length; i++)
{
UseResource(lista[i].GetResource(), a[0]);
}
}
}
......@@ -59,8 +59,5 @@ public class ResourcePool : MonoBehaviour
{
this.maxCapacity += x;
}
public void AddCollector()
{
Collector c = gameObject.AddComponent<Collector>();
}
}
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