diff --git a/Assets/Prefab/Cloud.prefab b/Assets/Prefab/Cloud.prefab new file mode 100644 index 0000000000000000000000000000000000000000..a0aad86ad965db5233ace5d1e848b10134028394 --- /dev/null +++ b/Assets/Prefab/Cloud.prefab @@ -0,0 +1,94 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &6668825413784912564 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3688115099138184988} + - component: {fileID: 6429550116959099573} + - component: {fileID: 71507196037364545} + m_Layer: 0 + m_Name: Cloud + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3688115099138184988 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6668825413784912564} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.5467253, y: 2.434422, z: 0} + 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} +--- !u!212 &6429550116959099573 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6668825413784912564} + 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: 038ab914524b2d64a93a0e9c7e9ca39f, type: 3} + m_Color: {r: 0.6320754, g: 0.5933161, b: 0.5933161, 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!114 &71507196037364545 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6668825413784912564} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fc89ba7face02fd46bb95930a9f0fb6e, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Prefab/Cloud.prefab.meta b/Assets/Prefab/Cloud.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..814b6e9fdeea3309a3f433ab5bb62d8851ceb748 --- /dev/null +++ b/Assets/Prefab/Cloud.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2babd10b31bdc6d428669be0be6eb6df +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefab/CloudSpawner.prefab b/Assets/Prefab/CloudSpawner.prefab new file mode 100644 index 0000000000000000000000000000000000000000..dfe27dd1f33f470d7d4f7d790d0405611ad8a660 --- /dev/null +++ b/Assets/Prefab/CloudSpawner.prefab @@ -0,0 +1,47 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2273889863124468236 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6415748420902447954} + - component: {fileID: 3503099184736584472} + m_Layer: 0 + m_Name: CloudSpawner + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6415748420902447954 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2273889863124468236} + 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} +--- !u!114 &3503099184736584472 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2273889863124468236} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a991ff8c67bd56d448502bfbce3b0a4e, type: 3} + m_Name: + m_EditorClassIdentifier: + cloudPrefab: {fileID: 6668825413784912564, guid: 2babd10b31bdc6d428669be0be6eb6df, + type: 3} diff --git a/Assets/Prefab/CloudSpawner.prefab.meta b/Assets/Prefab/CloudSpawner.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..115b1e86c3e1e568df9f4d95d397af108588a920 --- /dev/null +++ b/Assets/Prefab/CloudSpawner.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a9cea436032f3c1418588f10288f7d7c +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Cloud.cs b/Assets/Scripts/Cloud.cs new file mode 100644 index 0000000000000000000000000000000000000000..02a6a6a9eb93644e614cea8d1e8e45a17f593f5c --- /dev/null +++ b/Assets/Scripts/Cloud.cs @@ -0,0 +1,24 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Cloud : MonoBehaviour +{ + + private void Start() + { + transform.localScale = new Vector3(Random.Range(2f, 5f), Random.Range(2f, 5f), 1); + } + + void Update() + { + float x = transform.position.x; + transform.position = new Vector3(x-0.1f, transform.position.y, transform.position.z); + + } + + private void OnBecameInvisible() + { + Destroy(gameObject); + } +} diff --git a/Assets/Scripts/Cloud.cs.meta b/Assets/Scripts/Cloud.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..b91ea31e52cfac2f90b2d49419e26daa613f5532 --- /dev/null +++ b/Assets/Scripts/Cloud.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fc89ba7face02fd46bb95930a9f0fb6e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/CloudSpawner.cs b/Assets/Scripts/CloudSpawner.cs new file mode 100644 index 0000000000000000000000000000000000000000..d7317e192e2d3c4bd738474df46ed25075a5d016 --- /dev/null +++ b/Assets/Scripts/CloudSpawner.cs @@ -0,0 +1,26 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class CloudSpawner : MonoBehaviour +{ + [SerializeField] + private GameObject cloudPrefab = null; + + // Start is called before the first frame update + void Start() + { + StartCoroutine("StartSpawning"); + } + + private IEnumerator StartSpawning() { + while (true) + { + GameObject go = Instantiate<GameObject>(cloudPrefab); + Vector3 min = Camera.main.ScreenToWorldPoint(new Vector3(Camera.main.pixelWidth, 0, -10)); + Vector3 max = Camera.main.ScreenToWorldPoint(new Vector3(Camera.main.pixelWidth, Camera.main.pixelHeight, -10)); + go.transform.position = new Vector3(max.x+10, Random.Range(min.y,max.y),-5); + yield return new WaitForSeconds(Random.Range(2, 7)); + } + } +} diff --git a/Assets/Scripts/CloudSpawner.cs.meta b/Assets/Scripts/CloudSpawner.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2d0acdabfa93950ad359507c4fc44fc25dfff106 --- /dev/null +++ b/Assets/Scripts/CloudSpawner.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a991ff8c67bd56d448502bfbce3b0a4e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: