diff --git a/Assets/Prefab/GameWin.prefab b/Assets/Prefab/GameWin.prefab new file mode 100644 index 0000000000000000000000000000000000000000..ab55e8946f78dc9ce5c1a71d660b16cc13ca433a --- /dev/null +++ b/Assets/Prefab/GameWin.prefab @@ -0,0 +1,32 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4334850820553036048 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2388334960364419616} + m_Layer: 0 + m_Name: GameWin + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2388334960364419616 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4334850820553036048} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 4.5898275, y: 3.887589, z: 0.94433594} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Prefab/GameWin.prefab.meta b/Assets/Prefab/GameWin.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..d3c5c32464a6079ae9a2b49b443a08dc373cb29b --- /dev/null +++ b/Assets/Prefab/GameWin.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 80a61f8911aa37046a2d5e13d579c221 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefab/Outcrop.prefab b/Assets/Prefab/Outcrop.prefab index 672f75ba77e0b03185550fe99c339092a869b8d3..4c9cbab81be33b9fc98989e98d22aa7d57e7f1b1 100644 --- a/Assets/Prefab/Outcrop.prefab +++ b/Assets/Prefab/Outcrop.prefab @@ -13,8 +13,8 @@ GameObject: - component: {fileID: 5733991913862907517} - component: {fileID: 7985519473791055737} m_Layer: 0 - m_Name: StoneResource - m_TagString: Resource + m_Name: Outcrop + m_TagString: Buildable m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 @@ -94,7 +94,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: wood: 0 - quarry: {fileID: 0} --- !u!61 &7985519473791055737 BoxCollider2D: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/MainMenu.unity b/Assets/Scenes/MainMenu.unity index 4486db29f33e694d207d640e490acd68da362bc5..b92f68b785330456d501f372f32f7129a71009cc 100644 --- a/Assets/Scenes/MainMenu.unity +++ b/Assets/Scenes/MainMenu.unity @@ -185,7 +185,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 834199860} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 5.2034483, y: 2.3731437, z: 0} + m_LocalPosition: {x: -0.16, y: -2.91, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -264,7 +264,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1242906259} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -5.3051963, y: 2.9021022, z: 0} + m_LocalPosition: {x: 5.65, y: 1.53, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -343,7 +343,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1334682652} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -3.89, y: -3.87, z: 0} + m_LocalPosition: {x: -5.34, y: -2.93, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -359,6 +359,8 @@ GameObject: m_Component: - component: {fileID: 1346472592} - component: {fileID: 1346472591} + - component: {fileID: 1346472594} + - component: {fileID: 1346472593} m_Layer: 0 m_Name: ExitButton m_TagString: Untagged @@ -403,8 +405,8 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 1 - m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} - m_Color: {r: 0.990566, g: 0, b: 0, a: 1} + m_Sprite: {fileID: 21300002, guid: 96af674e67bc4b521aa75450c40dfcbf, type: 3} + m_Color: {r: 0.8980393, g: 0.8980393, b: 0.8980393, a: 1} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 @@ -422,12 +424,52 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1346472590} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: -1.22, z: 0.058931645} - m_LocalScale: {x: 20, y: 5, z: 1} + m_LocalPosition: {x: 2.5, y: 0, z: 0.058931645} + m_LocalScale: {x: 3, y: 3, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!61 &1346472593 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1346472590} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 0.16, y: 0.16} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1, y: 1} + m_EdgeRadius: 0 +--- !u!114 &1346472594 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1346472590} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6b987107b9a225144a51d7e298dbf2aa, type: 3} + m_Name: + m_EditorClassIdentifier: + playButton: {fileID: 1377888703} + exitButton: {fileID: 1346472590} --- !u!1 &1377888703 GameObject: m_ObjectHideFlags: 0 @@ -438,6 +480,8 @@ GameObject: m_Component: - component: {fileID: 1377888705} - component: {fileID: 1377888704} + - component: {fileID: 1377888707} + - component: {fileID: 1377888708} m_Layer: 0 m_Name: PlayButton m_TagString: Untagged @@ -482,8 +526,8 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 1 - m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} - m_Color: {r: 0.013082923, g: 0.9245283, b: 0.18797691, a: 1} + m_Sprite: {fileID: 21300000, guid: 96af674e67bc4b521aa75450c40dfcbf, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 @@ -501,12 +545,131 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1377888703} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 1.14, z: 0.058931645} - m_LocalScale: {x: 20, y: 5, z: 1} + m_LocalPosition: {x: -2.5, y: 0, z: 0.058931645} + m_LocalScale: {x: 3, y: 3, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1377888707 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1377888703} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6b987107b9a225144a51d7e298dbf2aa, type: 3} + m_Name: + m_EditorClassIdentifier: + playButton: {fileID: 1377888703} + exitButton: {fileID: 1346472590} +--- !u!61 &1377888708 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1377888703} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 0.16, y: 0.16} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1, y: 1} + m_EdgeRadius: 0 +--- !u!1 &1490674628 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1490674630} + - component: {fileID: 1490674629} + m_Layer: 0 + m_Name: rock (4) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &1490674629 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1490674628} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 1 + m_Sprite: {fileID: 21300000, guid: 2d5618b5caec3c7d6bac162c4cd0a034, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &1490674630 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1490674628} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -5.29, y: 2.63, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1507413978 GameObject: m_ObjectHideFlags: 0 @@ -580,7 +743,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1507413978} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 4.25, y: -2.0348446, z: 0} + m_LocalPosition: {x: 5.62, y: -2.75, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -640,8 +803,8 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 - m_Sprite: {fileID: 21300000, guid: fe463401d3186b54086acff6bb82891f, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Color: {r: 1, g: 0.9111515, b: 0.6084906, a: 1} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 @@ -659,8 +822,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1807990412} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.08, y: -0.1, z: 0} - m_LocalScale: {x: 13, y: 10, z: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 150, y: 100, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 1 diff --git a/Assets/Scripts/Collector.cs b/Assets/Scripts/Collector.cs index 56f8cae6af3e7a7dc68eafd684907271a70bca04..dbce85ff9fad77f400ea939422f0277e788de61f 100644 --- a/Assets/Scripts/Collector.cs +++ b/Assets/Scripts/Collector.cs @@ -13,6 +13,15 @@ public class Collector : MonoBehaviour [SerializeField] private int max_amount = 10; + [SerializeField] + private int Requested_amount; + + [SerializeField] + private Resource Requested_resource; + + [SerializeField] + private bool OnkoVapaa; + [SerializeField] private int amount; @@ -26,6 +35,8 @@ public class Collector : MonoBehaviour [SerializeField] private GameObject target_flag; + [SerializeField] + private bool send_to_resource; public GameObject flag; // Start is called before the first frame update void Start() @@ -33,6 +44,14 @@ public class Collector : MonoBehaviour home = GameObject.FindGameObjectWithTag("Home"); } + public void SetOnkoVapaa(bool vapaa) + { + this.OnkoVapaa = vapaa; + } + public bool tarkistaVapaus() + { + return this.OnkoVapaa; + } public void SetTarget(GameObject target) { this.target = target; @@ -41,10 +60,18 @@ public class Collector : MonoBehaviour { this.move_to = target; } - + public Resource getResource() + { + return this.resource; + } + public void SetSend_to_resource(bool r) + { + this.send_to_resource = r; + } // Update is called once per frame void Update() { + if (Input.GetMouseButtonDown(0)) { Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); @@ -53,6 +80,16 @@ public class Collector : MonoBehaviour RaycastHit2D hit = Physics2D.Raycast(mousePos2D, Vector2.zero); if (hit.collider != null) { + if (hit.collider.gameObject.tag == "Home") + home.gameObject.GetComponent<City>().AddCollector(); + if (hit.collider.gameObject.GetComponent<Outcrop>() != null) + { + this.send_to_resource = true; + } + else + { + this.send_to_resource = false; + } DestroyImmediate(target_flag); target_flag = Instantiate(flag, hit.point, Quaternion.identity); target_flag.GetComponent<Flag>().SetWorker(this.gameObject); @@ -72,30 +109,51 @@ public class Collector : MonoBehaviour if(collision.gameObject.transform.position == target_flag.transform.position) { if(resource == null) { - /*if(target.GetComponent<Resource>().vie_tavaraa()) + if(home.GetComponent<BoxCollider2D>().bounds.Contains(new Vector3(target_flag.transform.position.x, target_flag.transform.position.y,home.transform.position.z))) { - + Destroy(target_flag); + } + else if (send_to_resource && target.GetComponent<Outcrop>()) + { + if(this.amount > 0) + target.GetComponent<Outcrop>().setAmount(this.amount); + //Requested_resource = target.GetComponent<Outcrop>(); + Requested_amount = target.GetComponent<Outcrop>().stillNeeded(); + StartCoroutine("goHome"); } else - {*/ + { //Amount of resources worker is carrying right now this.amount = target.GetComponent<Resource>().extractResource(this.max_amount); //Gives target resource to resource variable this.resource = this.target.GetComponent<Resource>(); - //} - + StartCoroutine("goHome"); + } + + } - StartCoroutine("goHome"); + else + StartCoroutine("goHome"); } } - if (collision.gameObject.tag == "Home" && this.resource != null) + if (move_to.gameObject.tag == "Home" && this.resource != null) { - //resets amount and resource variables - collision.gameObject.GetComponent<City>().AddResource(this.resource, this.amount); - this.amount = 0; - this.resource = null; - MoveTo(this.target); - + if (target.GetComponent<Outcrop>()) + { + /*if(this.Requested_amount < this.max_amount) + this.amount = home.GetComponent<City>().UseResource(, this.Requested_amount); + else + this.amount = home.GetComponent<City>().UseResource(, this.max_amount);*/ + } + else + { + + //resets amount and resource variables + collision.gameObject.GetComponent<City>().AddResource(this.resource, this.amount); + this.amount = 0; + this.resource = null; + } + MoveTo(this.target); } } IEnumerator goHome() diff --git a/Assets/Scripts/GameEnd.meta b/Assets/Scripts/GameEnd.meta new file mode 100644 index 0000000000000000000000000000000000000000..c8eeb410ce05a432ddf5c3cdb6921197f6520fbc --- /dev/null +++ b/Assets/Scripts/GameEnd.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cf62eacc43e8a40469118b61f12a5364 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/GameEnd/MoveRandomly.cs b/Assets/Scripts/GameEnd/MoveRandomly.cs new file mode 100644 index 0000000000000000000000000000000000000000..9db50ad0882f21a98bb1ee0435c331a9b8d73f29 --- /dev/null +++ b/Assets/Scripts/GameEnd/MoveRandomly.cs @@ -0,0 +1,29 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class MoveRandomly : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + StartCoroutine("moveAround"); + } + + private IEnumerator moveAround() { + while (true) + { + float moveTime = Random.value * 2; + float timeSpent = 0; + Vector3 direction = new Vector3(Random.value*2-1,Random.value*2-1, 0); + + while (timeSpent < moveTime) + { + transform.position = transform.position + direction*0.01f; + yield return null; + timeSpent += Time.deltaTime; + + } + } + } +} diff --git a/Assets/Scripts/GameEnd/MoveRandomly.cs.meta b/Assets/Scripts/GameEnd/MoveRandomly.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..bd2dc1b097a707426f83a4b0db133d5cd34a8451 --- /dev/null +++ b/Assets/Scripts/GameEnd/MoveRandomly.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d3063605b31636c4e9998676be17db5d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/GameEnd/WinGame.cs b/Assets/Scripts/GameEnd/WinGame.cs new file mode 100644 index 0000000000000000000000000000000000000000..519f1dab23788a6954388cf655b47e5e0c57741c --- /dev/null +++ b/Assets/Scripts/GameEnd/WinGame.cs @@ -0,0 +1,60 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class WinGame : MonoBehaviour +{ + [SerializeField] + private GameObject housePrefab = null; + [SerializeField] + private GameObject workerPrefab = null; + + private List<GameObject> houses = new List<GameObject>(); + + void Start() + { + StartCoroutine("MoveCamera"); + StartCoroutine("EndGame"); + } + private IEnumerator MoveCamera() + { + while (Camera.main.orthographicSize < 9f) { + Camera.main.orthographicSize += 0.01f; + yield return null; + } + } + + private IEnumerator EndGame() + { + float spawnRate = 5f; + int count = 0; + while (count < 9) + { + GameObject go = Instantiate<GameObject>(housePrefab); + houses.Add(go); + go.transform.position = new Vector3(Random.Range(1f, 14f), Random.Range(1f, 14f),-5); + spawnRate -= 0.5f; + yield return new WaitForSeconds(spawnRate); + count++; + } + for (int i = 0; i < 3; i++) { + GameObject go = Instantiate<GameObject>(housePrefab); + houses.Add(go); + go.transform.position = new Vector3(Random.Range(1f, 14f), Random.Range(1f, 14f), -5); + yield return new WaitForSeconds(spawnRate); + } + count = 0; + while (count < 150) + { + GameObject go = Instantiate<GameObject>(workerPrefab); + int index = Random.Range(0, houses.Count); + go.transform.position = houses[index].transform.position; + go.AddComponent<MoveRandomly>(); + Destroy(go.GetComponent<Collector>()); + Destroy(go.GetComponent<Rigidbody2D>()); + yield return new WaitForSeconds(0.1f); + count++; + } + } + +} diff --git a/Assets/Scripts/GameEnd/WinGame.cs.meta b/Assets/Scripts/GameEnd/WinGame.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..a6fa2a8111d55b06cef7ef6d9d7d9b0fa36d9e3d --- /dev/null +++ b/Assets/Scripts/GameEnd/WinGame.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d3674a5cdecf6e14abe5d88e6f0f7618 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/GroundGenerator/GroundGenerator.cs b/Assets/Scripts/GroundGenerator/GroundGenerator.cs index 587a72a5bd7087870dd8afe32d7458090b09c3b7..0121597232f777d7f4d0141105cc464146c4ca7e 100644 --- a/Assets/Scripts/GroundGenerator/GroundGenerator.cs +++ b/Assets/Scripts/GroundGenerator/GroundGenerator.cs @@ -151,7 +151,7 @@ public class GroundGenerator : MonoBehaviour private void createHome() { ground[ground.GetLength(0) / 2, ground.GetLength(1) / 2] = home; spawn(homeGO, houseCoords[0], houseCoords[1], houseDepth); - spawn(workerGO, houseCoords[0], houseCoords[1], workerDepth); + homeGO.GetComponent<City>().AddCollector(); } private GameObject spawn(GameObject go, int x, int y, int z) { return Instantiate<GameObject>(go, new Vector3(x, y, z), Quaternion.identity); diff --git a/Assets/Scripts/MenuSript.cs b/Assets/Scripts/MenuSript.cs new file mode 100644 index 0000000000000000000000000000000000000000..ecb8b1274f3c4403015e8bfd46a55f4b8aaf81c4 --- /dev/null +++ b/Assets/Scripts/MenuSript.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class MenuSript : MonoBehaviour +{ + [SerializeField] + private GameObject playButton; + [SerializeField] + private GameObject exitButton; + + private void OnMouseDown() { + if (gameObject == exitButton) { + Application.Quit(); + } + if (gameObject == playButton) { + UnityEngine.SceneManagement.SceneManager.LoadScene(1); + } + + } +} diff --git a/Assets/Scripts/MenuSript.cs.meta b/Assets/Scripts/MenuSript.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..7f2f2f13b9d93390011930dd8a3647d349262583 --- /dev/null +++ b/Assets/Scripts/MenuSript.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6b987107b9a225144a51d7e298dbf2aa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Resources/Forest.cs b/Assets/Scripts/Resources/Forest.cs index 8d733537cfe36c3b06e9d529f52be0544a5ae510..50385e04ff0afb722cc00e1c1d6f5c0ffd9acac6 100644 --- a/Assets/Scripts/Resources/Forest.cs +++ b/Assets/Scripts/Resources/Forest.cs @@ -74,12 +74,6 @@ public class Forest : Resource StartCoroutine("Grow"); } - // Update is called once per frame - void Update() - { - - } - IEnumerator Grow() { while (getAmount() < 1000) diff --git a/Assets/Scripts/Resources/Outcrop.cs b/Assets/Scripts/Resources/Outcrop.cs index 2b52283acb0ee8c7feca72b1a288b9c6eefb3256..1d7940bf0cdd306d026e6c9a376f3f8020e68cbe 100644 --- a/Assets/Scripts/Resources/Outcrop.cs +++ b/Assets/Scripts/Resources/Outcrop.cs @@ -11,6 +11,7 @@ public class Outcrop : MonoBehaviour private int woodNeeded = 100; private GameObject quarry; + public Resource neededResource; public int getAmount() { @@ -48,6 +49,9 @@ public class Outcrop : MonoBehaviour void Start() { setAmount(0); + GameObject go = new GameObject(); + neededResource = go.AddComponent<Forest>(); + neededResource.enabled = false; } // Update is called once per frame diff --git a/Assets/Scripts/Resources/Quarry.cs b/Assets/Scripts/Resources/Quarry.cs index 2975e62dd47fb7c409ca1768fc3485a3bef16974..cbf90dc7c972d58bf31a206c150c736fe21d75fe 100644 --- a/Assets/Scripts/Resources/Quarry.cs +++ b/Assets/Scripts/Resources/Quarry.cs @@ -44,7 +44,7 @@ public class Quarry : Resource // Start is called before the first frame update void Start() { - + setEventType(EventType.StoneCut); setAmount(Random.Range(2000, 4000)); } diff --git a/Assets/Sprites/Cloud.png b/Assets/Sprites/Cloud.png new file mode 100644 index 0000000000000000000000000000000000000000..f5b3b9b65884e88abe6728a105348d1e48723d3e Binary files /dev/null and b/Assets/Sprites/Cloud.png differ diff --git a/Assets/Sprites/Destination_b.png b/Assets/Sprites/Destination_b.png new file mode 100644 index 0000000000000000000000000000000000000000..a3ce12c1395170d641a742b2be54e42f0fcf3f3a Binary files /dev/null and b/Assets/Sprites/Destination_b.png differ diff --git a/Assets/Sprites/Destination_pointer.png b/Assets/Sprites/Destination_pointer.png new file mode 100644 index 0000000000000000000000000000000000000000..f1768a24f7033931bc47c41b44cadd541f876c79 Binary files /dev/null and b/Assets/Sprites/Destination_pointer.png differ diff --git a/Assets/Sprites/Ground.xcf b/Assets/Sprites/Ground.xcf index ff8d57744e11c2991942ea87d2013b2a9293f804..202a670723728f5954a0a05ee868edc8b82fbadb 100644 Binary files a/Assets/Sprites/Ground.xcf and b/Assets/Sprites/Ground.xcf differ diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 82ab0f5910d77eeadb7c1c203cda1daaeac0327f..a25e4a7aca2ce55c31725386fb5bc1dc9244d270 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -5,7 +5,13 @@ EditorBuildSettings: m_ObjectHideFlags: 0 serializedVersion: 2 m_Scenes: + - enabled: 0 + path: + guid: 00000000000000000000000000000000 - enabled: 1 - path: Assets/Scenes/SampleScene.unity - guid: 2cda990e2423bbf4892e6590ba056729 + path: Assets/Scenes/MainMenu.unity + guid: 782780faed4d8b1409a6034453c0627c + - enabled: 1 + path: Assets/Scenes/MainScene.unity + guid: cad276c071768944288a0c09b5741599 m_configObjects: {} diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 07d529912098620c87aeb761dfa15f941a273be1..777421a914b132776eb22ce8a45d5075a162e22a 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -8,6 +8,8 @@ TagManager: - Tree - Resource - Home + - Flag + - Buildable layers: - Default - TransparentFX