Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • eolokk/game_jam19
  • lejugr/game_jam19
  • tmpoht/game_jam19
  • kjahei/game_jam19
  • makalo/game_jam19
5 results
Show changes
Showing
with 398 additions and 5 deletions
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BuyCapacity : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnMouseOver()
{
if (Input.GetMouseButtonDown(1))
{
City c = transform.root.gameObject.GetComponent<City>();
if (c.IsSufficientResources(createResourceGO(), 50))
{
List<int> cost = new List<int>() { 50, 50, 50 };
c.UseResources(cost);
c.IncreaseCapacity(50);
EventSystem.EventHappened(EventType.UpgradeBuilt);
}
}
}
private List<Resource> createResourceGO() {
GameObject go = new GameObject();
go.AddComponent<Forest>();
go.AddComponent<Quarry>();
go.AddComponent<BerryBush>();
return new List<Resource>(go.GetComponents<Resource>());
}
}
fileFormatVersion: 2
guid: 94999d051d3d2a4438290a189966dcf8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BuyCity : MonoBehaviour
{
[SerializeField]
private GameObject endGame;
// Start is called before the first frame update
void Start()
{
if(!transform.root.gameObject.GetComponent<City>().IsSufficientResources(createResourceGO(), 150))
{
Color c = gameObject.GetComponent<SpriteRenderer>().color;
gameObject.GetComponent<SpriteRenderer>().color = c - new Color(25, 25, 25);
}
}
// Update is called once per frame
void Update()
{
}
private void OnMouseOver()
{
if (Input.GetMouseButtonDown(1))
{
City c = transform.root.gameObject.GetComponent<City>();
if (c.population > 200 && c.IsSufficientResources(createResourceGO(), 150))
{
Instantiate<GameObject>(endGame);
}
}
}
private List<Resource> createResourceGO()
{
GameObject go = new GameObject();
go.AddComponent<Forest>();
go.AddComponent<Quarry>();
go.AddComponent<BerryBush>();
return new List<Resource>(go.GetComponents<Resource>());
}
}
fileFormatVersion: 2
guid: 2d496a86a17b9d0489876dbf81a4e9bc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BuyCollector : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnMouseOver()
{
if (Input.GetMouseButtonDown(1))
{
City c = transform.root.gameObject.GetComponent<City>();
if (c.IsSufficientResources(createResourceGO(), 50))
{
List<int> cost = new List<int>() { 50, 50, 50 };
c.UseResources(cost);
c.AddCollector();
EventSystem.EventHappened(EventType.UpgradeBuilt);
}
}
}
private List<Resource> createResourceGO()
{
GameObject go = new GameObject();
go.AddComponent<Forest>();
go.AddComponent<Quarry>();
go.AddComponent<BerryBush>();
return new List<Resource>(go.GetComponents<Resource>());
}
}
fileFormatVersion: 2
guid: fb47c1de3fd43ba4384f11aad63ef0a0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BuyEfficiency : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnMouseOver()
{
if (Input.GetMouseButtonDown(1))
{
List<Resource> resources = new List<Resource>(3);
City c = transform.root.gameObject.GetComponent<City>();
if (c.IsSufficientResources(resources, 50))
{
List<int> cost = new List<int>() { 50, 50, 50 };
c.UseResources(cost);
EventSystem.EventHappened(EventType.UpgradeBuilt);
}
}
}
}
fileFormatVersion: 2
guid: 06839e5c330959c45a2523fafd4a33ab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BuyPopulation : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnMouseOver()
{
if (Input.GetMouseButtonDown(1))
{
City c = transform.root.gameObject.GetComponent<City>();
List<int> cost = new List<int>() { 50, 50, 50 };
if (c.IsSufficientResources(createResourceGO(), 50))
{
c.UseResources(cost);
c.AddPopulation(50);
EventSystem.EventHappened(EventType.UpgradeBuilt);
} else
{
Debug.Log("Not enough resources");
}
}
}
private List<Resource> createResourceGO()
{
GameObject go = new GameObject();
go.AddComponent<Forest>();
go.AddComponent<Quarry>();
go.AddComponent<BerryBush>();
return new List<Resource>(go.GetComponents<Resource>());
}
}
fileFormatVersion: 2
guid: 515574251ae631045a8464c9761619c7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BuySpeed : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnMouseOver()
{
if (Input.GetMouseButtonDown(1))
{
City c = transform.root.gameObject.GetComponent<City>();
if (c.IsSufficientResources(createResourceGO(), 50))
{
c.UpgradeWorkerSpeed();
List<int> cost = new List<int>() { 50, 50, 50 };
c.UseResources(cost);
EventSystem.EventHappened(EventType.UpgradeBuilt);
}
}
}
private List<Resource> createResourceGO()
{
GameObject go = new GameObject();
go.AddComponent<Forest>();
go.AddComponent<Quarry>();
go.AddComponent<BerryBush>();
return new List<Resource>(go.GetComponents<Resource>());
}
}
fileFormatVersion: 2
guid: 9c1faba44d65021418a87209c49f7953
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UpgradeShop : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnMouseEnter()
{
}
}
fileFormatVersion: 2
guid: 2cc06fd360e0e1b44b66092a664bafe1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UsableResources : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
fileFormatVersion: 2
guid: 132e9ec36ed413a4b868b617846af5e7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -23,8 +23,9 @@ public class CollectorUpgrade : Upgrade
City city = gameObject.GetComponent<City>();
int currentLevel = city.GetLevel(target);
if (currentLevel <= city.GetLevel(UpgradeTargets.city) * maxLevelModifier)
if (currentLevel <= maxLevelModifier)
{
Debug.Log("Collector Upgraded");
city.UseResources(GetPrices(currentLevel));
city.AddCollector();
}
......
......@@ -39,9 +39,10 @@ public class PopulationUpgrade : Upgrade
break;
}
*/
if (currentLevel <= city.GetLevel(UpgradeTargets.city) * maxLevelModifier)
if (currentLevel <= maxLevelModifier)
{
city.UseResources(GetPrices(currentLevel + 1));
city.populationLevel++;
city.AddPopulation(currentLevel * 10);
Debug.Log("population upgraded");
}
......
......@@ -22,10 +22,11 @@ public class ResourceCapacityUpgrade : Upgrade
City city = gameObject.GetComponent<City>();
int currentLevel = city.GetLevel(target);
if (currentLevel <= city.GetLevel(UpgradeTargets.city) * maxLevelModifier)
if (currentLevel <= maxLevelModifier)
{
city.UseResources((GetPrices(currentLevel)));
city.IncreaseCapacity(currentLevel * 100);
city.resourcePoolLevel++;
city.IncreaseCapacity(currentLevel * 100);
Debug.Log("Capacity upgraded");
}
}
......
......@@ -24,7 +24,7 @@ public class RoadUpgrade : Upgrade
City city = gameObject.GetComponent<City>();
int currentLevel = (int) road.GetLevel(target);
if (currentLevel <= city.GetLevel(UpgradeTargets.city) * maxLevelModifier)
if (currentLevel <= maxLevelModifier)
{
city.UseResources(GetPrices(currentLevel));
road.IncreaseSpeed(1 / currentLevel);
......