diff --git a/Assets/Audio/Ogg/Winmusic.ogg b/Assets/Audio/Ogg/Winmusic.ogg new file mode 100644 index 0000000000000000000000000000000000000000..ae9951fcd250940d5ae74b8a32f3bea4d3e98d20 Binary files /dev/null and b/Assets/Audio/Ogg/Winmusic.ogg differ diff --git a/Assets/Audio/Ogg/Winmusic.ogg.meta b/Assets/Audio/Ogg/Winmusic.ogg.meta new file mode 100644 index 0000000000000000000000000000000000000000..f4faa4ff2e9f5c0a5445314edbf52559e723719b --- /dev/null +++ b/Assets/Audio/Ogg/Winmusic.ogg.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 584a9744e24de204abc89d99211a232b +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/Prefab/City.prefab b/Assets/Prefab/City.prefab index c2b9030c0db9493c59dd7071cf9b030a85f03444..9109199ad80b31aff1f4c663fbda86dbd9a1aa59 100644 --- a/Assets/Prefab/City.prefab +++ b/Assets/Prefab/City.prefab @@ -11,7 +11,7 @@ GameObject: - component: {fileID: 7607310651946833764} - component: {fileID: 7607310651946833763} - component: {fileID: 7607310651946833765} - - component: {fileID: 7607310651946833766} + - component: {fileID: 2939609430767332389} m_Layer: 0 m_Name: City m_TagString: Home @@ -29,7 +29,8 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0.3698252, y: 0.5438592, z: -0.01} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] + m_Children: + - {fileID: 3746671060121448619} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -107,7 +108,7 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 1.28, y: 1.28} m_EdgeRadius: 0 ---- !u!114 &7607310651946833766 +--- !u!114 &2939609430767332389 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -116,13 +117,112 @@ MonoBehaviour: m_GameObject: {fileID: 7607310651946833762} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: dfe928a858872424991e927606dd4bc3, type: 3} + m_Script: {fileID: 11500000, guid: f67208887d2c19940b9afdc55a275b38, type: 3} m_Name: m_EditorClassIdentifier: + respanelPrefab: {fileID: 3345454733487414898, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + resrowPrefab: {fileID: 5085001290068357248, guid: 72232997f27e3c2448b5ad647af22a35, + type: 3} workerlista: [] worker: {fileID: 548039319383633024, guid: 7dc194a2047a39340a91ca7636a56290, type: 3} population: 0 populationLevel: 0 resourcePoolLevel: 0 roadLevel: 0 - collectorLevel: 0 + paneelienmaara: 0 +--- !u!1001 &5416443199572362591 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 7607310651946833764} + m_Modifications: + - target: {fileID: 3345454733487414898, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_Name + value: ResourcePanel + objectReference: {fileID: 0} + - target: {fileID: 8707088784372610548, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_LocalPosition.x + value: -0.048 + objectReference: {fileID: 0} + - target: {fileID: 8707088784372610548, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_LocalPosition.y + value: -1.51 + objectReference: {fileID: 0} + - target: {fileID: 8707088784372610548, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_LocalPosition.z + value: 0.01 + objectReference: {fileID: 0} + - target: {fileID: 8707088784372610548, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8707088784372610548, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8707088784372610548, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8707088784372610548, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8707088784372610548, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8707088784372610548, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8707088784372610548, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8707088784372610548, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 570719359789660831, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_LocalPosition.x + value: -1.266 + objectReference: {fileID: 0} + - target: {fileID: 570719359789660831, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_LocalPosition.y + value: 0.311 + objectReference: {fileID: 0} + - target: {fileID: 6645068624957739557, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_LocalPosition.x + value: -1.274 + objectReference: {fileID: 0} + - target: {fileID: 6645068624957739557, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + propertyPath: m_LocalPosition.y + value: 0.06 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 588b79ebfef5a2c4887615dc4856cc0c, type: 3} +--- !u!4 &3746671060121448619 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 8707088784372610548, guid: 588b79ebfef5a2c4887615dc4856cc0c, + type: 3} + m_PrefabInstance: {fileID: 5416443199572362591} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Prefab/ResourcePanel.prefab b/Assets/Prefab/ResourcePanel.prefab new file mode 100644 index 0000000000000000000000000000000000000000..946871f37c2d6fcdc8ede4fceed485384243fd9f --- /dev/null +++ b/Assets/Prefab/ResourcePanel.prefab @@ -0,0 +1,46 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3345454733487414898 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8707088784372610548} + - component: {fileID: 3730588026534604659} + m_Layer: 0 + m_Name: ResourcePanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8707088784372610548 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3345454733487414898} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.048, y: -1.51, z: 0.01} + m_LocalScale: {x: 3.267, y: 1.914, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &3730588026534604659 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3345454733487414898} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8430aaccc9adbd74c93d8d100f8d421a, type: 3} + m_Name: + m_EditorClassIdentifier: + respool: {fileID: 7418993124827082457, guid: 72232997f27e3c2448b5ad647af22a35, type: 3} diff --git a/Assets/Prefab/ResourcePanel.prefab.meta b/Assets/Prefab/ResourcePanel.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..816c1b8d2d5484978dc4fb45fd9931038148af44 --- /dev/null +++ b/Assets/Prefab/ResourcePanel.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 588b79ebfef5a2c4887615dc4856cc0c +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefab/ResourceRow.prefab b/Assets/Prefab/ResourceRow.prefab new file mode 100644 index 0000000000000000000000000000000000000000..bab5d5b1ecc4eaaa730ce2adfb540b97be1fb8b0 --- /dev/null +++ b/Assets/Prefab/ResourceRow.prefab @@ -0,0 +1,175 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2308576596148104492 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5007991825820669350} + - component: {fileID: 6445693634580716852} + m_Layer: 0 + m_Name: Sand + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5007991825820669350 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2308576596148104492} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 1.2059997, y: -0.10999938, z: 0} + m_LocalScale: {x: 0.70104766, y: 0.75656927, z: 1} + m_Children: [] + m_Father: {fileID: 5761957582027681033} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &6445693634580716852 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2308576596148104492} + 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: 0 + m_Sprite: {fileID: 21300000, guid: fe463401d3186b54086acff6bb82891f, 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.28, y: 1.28} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &5085001290068357248 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5761957582027681033} + - component: {fileID: 4731396907463146464} + - component: {fileID: 5839595969925691407} + m_Layer: 0 + m_Name: ResourceRow + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5761957582027681033 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5085001290068357248} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.387, y: 0.282, z: 0} + m_LocalScale: {x: 0.10027549, y: 0.14378266, z: 1} + m_Children: + - {fileID: 5007991825820669350} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &4731396907463146464 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5085001290068357248} + 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: 0 + m_Sprite: {fileID: 21300000, guid: 28f55f31ef54a8ad3a4167614cf51050, 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!114 &5839595969925691407 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5085001290068357248} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bd508a1c9a5505c498ef74ef59a55518, type: 3} + m_Name: + m_EditorClassIdentifier: + icon: {fileID: 0} diff --git a/Assets/Prefab/ResourceRow.prefab.meta b/Assets/Prefab/ResourceRow.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..fdeccf2837c51837dd86ecf9c90f4c04d24a7de6 --- /dev/null +++ b/Assets/Prefab/ResourceRow.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 72232997f27e3c2448b5ad647af22a35 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 7d5c3724086838691f018be11c3e561c4237f0d2..28552499b85aff1667b14af868a8c2edd73bc567 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -1076,7 +1076,7 @@ PrefabInstance: - target: {fileID: 203678261489018089, guid: 530bea3a047bd31458b647c456257c63, type: 3} propertyPath: musics.Array.size - value: 10 + value: 11 objectReference: {fileID: 0} - target: {fileID: 203678261489018089, guid: 530bea3a047bd31458b647c456257c63, type: 3} @@ -1128,6 +1128,11 @@ PrefabInstance: propertyPath: musics.Array.data[5] value: objectReference: {fileID: 8300000, guid: a5c5c1c02f056e04ca16e3277134468a, type: 3} + - target: {fileID: 203678261489018089, guid: 530bea3a047bd31458b647c456257c63, + type: 3} + propertyPath: musics.Array.data[10] + value: + objectReference: {fileID: 8300000, guid: 584a9744e24de204abc89d99211a232b, type: 3} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 530bea3a047bd31458b647c456257c63, type: 3} --- !u!1 &1968252522 diff --git a/Assets/Scripts/AudioSystem.cs b/Assets/Scripts/AudioSystem.cs index 8d431c78ab9b73454a122f3ed590df666adc391b..d2bcf2adc10d1caa1a116907b683d0c5ecd9bd2c 100644 --- a/Assets/Scripts/AudioSystem.cs +++ b/Assets/Scripts/AudioSystem.cs @@ -66,7 +66,10 @@ public class AudioSystem : MonoBehaviour, IAction { FanfareClip(); } - + if (type == EventType.WinMusic) + { + WinClip(); + } } @@ -114,7 +117,10 @@ public class AudioSystem : MonoBehaviour, IAction { StartCoroutine("FadeOutIn", new Timing(0, 0)); } - + public void WinClip() + { + StartCoroutine("FadeOutIn", new Timing(1, 10)); + } IEnumerator FadeOutIn(Timing t) { //yield return FadeOut(t.duration); yield return StartCoroutine("FadeOut", t.duration); diff --git a/Assets/Scripts/City.meta b/Assets/Scripts/City.meta new file mode 100644 index 0000000000000000000000000000000000000000..34bc10962b22dde5a6e4917de9a9d7551f96c31b --- /dev/null +++ b/Assets/Scripts/City.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c45a1140d8e06dd4c8f916b8a8d9b63d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/City.cs b/Assets/Scripts/City/City.cs similarity index 85% rename from Assets/Scripts/City.cs rename to Assets/Scripts/City/City.cs index 4886609f5fc63f9995dc146d10566b4958420929..f3f2fd1febe2dd1f650f2b7531d5349a9946f176 100644 --- a/Assets/Scripts/City.cs +++ b/Assets/Scripts/City/City.cs @@ -5,6 +5,12 @@ using UnityEngine; public class City : MonoBehaviour { + [SerializeField] + GameObject respanelPrefab; + + [SerializeField] + GameObject resrowPrefab; + [SerializeField] List<GameObject> workerlista; @@ -23,8 +29,10 @@ public class City : MonoBehaviour [SerializeField] public int roadLevel = 0; + public int paneelienmaara = 0; + + - // Start is called before the first frame update void Start() { @@ -107,12 +115,12 @@ public class City : MonoBehaviour */ public void AddResource(Resource r, int amount) { - if (amount<0) + if (amount < 0) { return; } ResourcePool[] lista = gameObject.GetComponents<ResourcePool>(); - + for (int i = 0; i < lista.Length; i++) { if (lista[i].GetResource().GetType().Equals(r.GetType())) @@ -124,6 +132,16 @@ public class City : MonoBehaviour ResourcePool respool = gameObject.AddComponent<ResourcePool>(); respool.SetResource(r); respool.AddResource(amount); + if (paneelienmaara == 0) + { + GameObject respanel = Instantiate<GameObject>(respanelPrefab); + paneelienmaara++; + } + float x = gameObject.transform.position.x; + float y = gameObject.transform.position.y + 1f - lista.Length * 0.5f; + float z = gameObject.transform.position.z; + GameObject resrow = Instantiate<GameObject>(resrowPrefab); + resrow.GetComponent<ResourceRow>().SetRow(r, x - 2f, y, z); } /** diff --git a/Assets/Scripts/City.cs.meta b/Assets/Scripts/City/City.cs.meta similarity index 83% rename from Assets/Scripts/City.cs.meta rename to Assets/Scripts/City/City.cs.meta index ec6eefff5080908c3c44bbc667566a429ad9ccf0..fa190d4b08cf5a88b9f6ff67eb393e2049e18c6a 100644 --- a/Assets/Scripts/City.cs.meta +++ b/Assets/Scripts/City/City.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: dfe928a858872424991e927606dd4bc3 +guid: f67208887d2c19940b9afdc55a275b38 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/City/ResourcePanel.cs b/Assets/Scripts/City/ResourcePanel.cs new file mode 100644 index 0000000000000000000000000000000000000000..86589f769f695d1be421eb6a4994e70708c1eef4 --- /dev/null +++ b/Assets/Scripts/City/ResourcePanel.cs @@ -0,0 +1,28 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ResourcePanel : MonoBehaviour +{ + + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + ResourcePool[] lista = gameObject.GetComponents<ResourcePool>(); + for (int i = 0; i < lista.Length; i++) + { + UpdatePanel(lista[i]); + } + } + + public void UpdatePanel(ResourcePool respool) + { + + } +} diff --git a/Assets/Scripts/City/ResourcePanel.cs.meta b/Assets/Scripts/City/ResourcePanel.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d6721c9d2c15052d463440bcf5ab0449317ee5d5 --- /dev/null +++ b/Assets/Scripts/City/ResourcePanel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8430aaccc9adbd74c93d8d100f8d421a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ResourcePool.cs b/Assets/Scripts/City/ResourcePool.cs similarity index 88% rename from Assets/Scripts/ResourcePool.cs rename to Assets/Scripts/City/ResourcePool.cs index ce51047eb39df40df55b8882cc5c703731eb0c74..4877cd38fb320a76470ca1aedb3b5c45db454985 100644 --- a/Assets/Scripts/ResourcePool.cs +++ b/Assets/Scripts/City/ResourcePool.cs @@ -14,6 +14,17 @@ public class ResourcePool : MonoBehaviour [SerializeField] private int maxCapacity = 100; + private int oneBar = 25; + + private Sprite icon; + + public int CalcBars() + { + return maxCapacity / oneBar; + } + + + // Start is called before the first frame update void Start() { @@ -21,6 +32,7 @@ public class ResourcePool : MonoBehaviour public void SetResource(Resource r) { this.r = r; + icon = r.getResourceImg(); } public Resource GetResource() diff --git a/Assets/Scripts/ResourcePool.cs.meta b/Assets/Scripts/City/ResourcePool.cs.meta similarity index 83% rename from Assets/Scripts/ResourcePool.cs.meta rename to Assets/Scripts/City/ResourcePool.cs.meta index 4cac451edec3609387abc22103f7d8985058639d..8967ce0857b07a480df9e668ab654136c241066e 100644 --- a/Assets/Scripts/ResourcePool.cs.meta +++ b/Assets/Scripts/City/ResourcePool.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d5f9cff662cdcb44d9481366eacfa431 +guid: 1553b23dd4cf4794a91e075e2f2478f9 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/City/ResourceRow.cs b/Assets/Scripts/City/ResourceRow.cs new file mode 100644 index 0000000000000000000000000000000000000000..6f0f9c727f756fba71a5787b19b9e69ace1834e8 --- /dev/null +++ b/Assets/Scripts/City/ResourceRow.cs @@ -0,0 +1,31 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ResourceRow : MonoBehaviour +{ + private Resource r; + + private Sprite sprite; + + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } + + public void SetRow(Resource r, float x, float y, float z) + { + this.r = r; + this.GetComponent<SpriteRenderer>().sprite = r.getResourceImg(); + this.GetComponent<SpriteRenderer>().transform.position = new Vector3(x, y, z); + this.GetComponent<SpriteRenderer>().transform.localScale = new Vector3(0.35f, 0.35f, 1f); + } + +} diff --git a/Assets/Scripts/City/ResourceRow.cs.meta b/Assets/Scripts/City/ResourceRow.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..78d700e30738b5212f66bc1498a4a23f16379c9b --- /dev/null +++ b/Assets/Scripts/City/ResourceRow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bd508a1c9a5505c498ef74ef59a55518 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Resources/Outcrop.cs b/Assets/Scripts/Resources/Outcrop.cs index 83bed57a8a4c873038f9a08f34eb06f4984dfb1e..27d1cf8b5b5e0085c58bd2c4965b34b1daba5673 100644 --- a/Assets/Scripts/Resources/Outcrop.cs +++ b/Assets/Scripts/Resources/Outcrop.cs @@ -8,13 +8,13 @@ public class Outcrop : MonoBehaviour [SerializeField] private int wood; - private int woodNeeded = 100; + private readonly int woodNeeded = 100; [SerializeField] - private GameObject quarry; + private GameObject quarry =null; [SerializeField] - private Resource neededResource; + private Resource neededResource =null; public Resource getNeededResource() { @@ -28,12 +28,12 @@ public class Outcrop : MonoBehaviour public void setAmount(int amount) { - wood += amount; + wood = amount; } public void checkExistence() { - if (getAmount() >= 100) + if (getAmount() >= woodNeeded) { GameObject go = Instantiate<GameObject>(quarry); go.transform.position = this.transform.position; @@ -45,12 +45,11 @@ public class Outcrop : MonoBehaviour { setAmount(getAmount() + amount); checkExistence(); - woodNeeded -= getAmount(); } public int stillNeeded() { - return woodNeeded; + return woodNeeded-wood; } // Start is called before the first frame update