Skip to content
Snippets Groups Projects
Commit 5f632598 authored by Leevi Grönlund's avatar Leevi Grönlund
Browse files

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

parents f347637c 18a98dd0
No related branches found
No related tags found
No related merge requests found
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CityUpgrade : Upgrade
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void UpgradeCity()
{
UpgradeTargets target = UpgradeTargets.city;
City city = gameObject.GetComponent<City>();
int currentLevel = city.GetLevel(target);
if (city.GetLevel(UpgradeTargets.population) >= 5) {
city.UseResources(GetPrices(currentLevel * 10));
// city.IncreaseCityLevel(); currently not implemented in City
}
}
}
fileFormatVersion: 2
guid: d033c0fdb28116543820fef49807d764
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -8,12 +8,7 @@ public class CollectorUpgrade : Upgrade
// Start is called before the first frame update
void Start()
{
UpgradeTargets target = UpgradeTargets.collector;
City city = gameObject.GetComponent<City>();
int currentLevel = city.GetLevel(target);
city.UseResources(GetPrices(currentLevel));
city.AddCollector();
maxLevelModifier = 4;
}
// Update is called once per frame
......@@ -21,4 +16,13 @@ public class CollectorUpgrade : Upgrade
{
}
public void UpgradeCollector()
{
UpgradeTargets target = UpgradeTargets.collector;
City city = gameObject.GetComponent<City>();
int currentLevel = city.GetLevel(target);
city.UseResources(GetPrices(currentLevel));
city.AddCollector();
}
}
......@@ -7,7 +7,7 @@ public class PopulationUpgrade : Upgrade
// Start is called before the first frame update
public void Start()
{
maxLevelModifier = 10;
}
// Update is called once per frame
......
......@@ -7,7 +7,7 @@ public class ResourceCapacityUpgrade : Upgrade
// Start is called before the first frame update
void Start()
{
maxLevelModifier = 4;
}
// Update is called once per frame
......
......@@ -4,10 +4,11 @@ using UnityEngine;
public class RoadUpgrade : Upgrade
{
// Start is called before the first frame update
void Start()
{
maxLevelModifier = 2;
}
// Update is called once per frame
......
......@@ -4,11 +4,8 @@ using UnityEngine;
public abstract class Upgrade : MonoBehaviour
{
/*
private float baseWoodCost = 10;
private float baseStoneCost = 10;
private float baseFoodCost = 10;
*/
protected int maxLevelModifier;
private float efficiencyLevel = 1;
private Dictionary<Resources, int> resources = new Dictionary<Resources, int>();
......
......@@ -3,5 +3,5 @@ using System.Collections.Generic;
using UnityEngine;
public enum UpgradeTargets
{population, capacity, speed, collector}
{population, capacity, speed, collector, city}
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