diff --git a/Assets/Audio/Ogg/GM19_Fanfaari.ogg b/Assets/Audio/Ogg/GM19_Fanfaari.ogg new file mode 100644 index 0000000000000000000000000000000000000000..fa47633dfb2567caffc8720b58daf7d15a5cc3b7 Binary files /dev/null and b/Assets/Audio/Ogg/GM19_Fanfaari.ogg differ diff --git a/Assets/Audio/Ogg/GM19_Fanfaari.ogg.meta b/Assets/Audio/Ogg/GM19_Fanfaari.ogg.meta new file mode 100644 index 0000000000000000000000000000000000000000..c4c1ae27b8b9bc7ad554db712ebf30c8a2721f23 --- /dev/null +++ b/Assets/Audio/Ogg/GM19_Fanfaari.ogg.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 92c943f07ca06a24eaefb388684f1393 +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Audio/Ogg/GM19_Upgrade.ogg b/Assets/Audio/Ogg/GM19_Upgrade.ogg new file mode 100644 index 0000000000000000000000000000000000000000..7b525c905199326c20264cfadfac8091f23c750d Binary files /dev/null and b/Assets/Audio/Ogg/GM19_Upgrade.ogg differ diff --git a/Assets/Audio/Ogg/GM19_Upgrade.ogg.meta b/Assets/Audio/Ogg/GM19_Upgrade.ogg.meta new file mode 100644 index 0000000000000000000000000000000000000000..a7d3451cc2709b0e7623ec70c685129c6f65b794 --- /dev/null +++ b/Assets/Audio/Ogg/GM19_Upgrade.ogg.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 45e52c1f15bed25449d1ddf3e788c063 +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 09ade890073beeabc2779ec63d68523dae291e00..055c24e5dfc849de9a88ee10f9904d9aa8709668 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -303,7 +303,7 @@ PrefabInstance: type: 3} propertyPath: musics.Array.data[0] value: - objectReference: {fileID: 0} + objectReference: {fileID: 8300000, guid: 92c943f07ca06a24eaefb388684f1393, type: 3} - target: {fileID: 203678261489018089, guid: 530bea3a047bd31458b647c456257c63, type: 3} propertyPath: musics.Array.data[1] @@ -323,7 +323,7 @@ PrefabInstance: type: 3} propertyPath: musics.Array.data[4] value: - objectReference: {fileID: 0} + objectReference: {fileID: 8300000, guid: 45e52c1f15bed25449d1ddf3e788c063, type: 3} - target: {fileID: 203678261489018089, guid: 530bea3a047bd31458b647c456257c63, type: 3} propertyPath: musics.Array.data[5] diff --git a/Assets/Scripts/AudioSystem.cs b/Assets/Scripts/AudioSystem.cs index 1457b79780e11e30a8482cbbc1007c68d1dfd042..8d431c78ab9b73454a122f3ed590df666adc391b 100644 --- a/Assets/Scripts/AudioSystem.cs +++ b/Assets/Scripts/AudioSystem.cs @@ -60,11 +60,11 @@ public class AudioSystem : MonoBehaviour, IAction } if (type == EventType.UpgradeBuilt) { - + UpgradeClip(); } if (type == EventType.TimePeriodChanged) { - + FanfareClip(); } } @@ -106,6 +106,14 @@ public class AudioSystem : MonoBehaviour, IAction { StartCoroutine("PlayEffect", 9); } + public void UpgradeClip() + { + StartCoroutine("PlayEffect", 4); + } + public void FanfareClip() + { + StartCoroutine("FadeOutIn", new Timing(0, 0)); + } IEnumerator FadeOutIn(Timing t) { //yield return FadeOut(t.duration); 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/EventSystem/EventSystem.cs b/Assets/Scripts/EventSystem/EventSystem.cs index 8726731684a1ccf61644067348375e23738dc26b..89bed8037a5ae0ee6ab04d94a845316e0fe9edd2 100644 --- a/Assets/Scripts/EventSystem/EventSystem.cs +++ b/Assets/Scripts/EventSystem/EventSystem.cs @@ -15,11 +15,8 @@ public static class EventSystem public static void EventHappened(EventType name) { - Debug.Log("happened"); if (events.ContainsKey(name)) { - - Debug.Log("contains: "+events.Values.ToString()); foreach (IAction e in events[name]){ e.React(name); } 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/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/buttons.png b/Assets/Sprites/buttons.png new file mode 100644 index 0000000000000000000000000000000000000000..984b651850ced9178d49a0c538b0c765a0e1df28 Binary files /dev/null and b/Assets/Sprites/buttons.png differ diff --git a/Assets/Sprites/buttons.png.meta b/Assets/Sprites/buttons.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..5411780b515cd5cdc59464d164c55bbdb32c7add --- /dev/null +++ b/Assets/Sprites/buttons.png.meta @@ -0,0 +1,267 @@ +fileFormatVersion: 2 +guid: 96af674e67bc4b521aa75450c40dfcbf +TextureImporter: + fileIDToRecycleName: + 21300000: buttons_0 + 21300002: buttons_1 + 21300004: buttons_2 + 21300006: buttons_3 + 21300008: buttons_4 + 21300010: buttons_5 + 21300012: buttons_6 + 21300014: buttons_7 + externalObjects: {} + serializedVersion: 7 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 128 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: buttons_0 + rect: + serializedVersion: 2 + x: 0 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 51198a02961ec8294b64115eb6ff6913 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: buttons_1 + rect: + serializedVersion: 2 + x: 128 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 570e2d55f04c0a0a98019efc833c2094 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: buttons_2 + rect: + serializedVersion: 2 + x: 256 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 523511b84fe773d238a49daa3674d95f + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: buttons_3 + rect: + serializedVersion: 2 + x: 384 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: e8aa414f62aa2426fbd7ba20654821d1 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: buttons_4 + rect: + serializedVersion: 2 + x: 512 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 0ad130c4c9d976b3a8d5c72676555cbe + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: buttons_5 + rect: + serializedVersion: 2 + x: 640 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 2abbf7fbcaa53f8b5b6d5e833e2da49f + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: buttons_6 + rect: + serializedVersion: 2 + x: 768 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 3c4caabb02fcea99e90faef8a46f8902 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: buttons_7 + rect: + serializedVersion: 2 + x: 896 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 642a9fdc613a1c22099c77af27a5abd1 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: ee8d938a4e9555b2d98bde50cd545208 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: