diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index f369193..d7bcf25 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -68,6 +68,7 @@ + diff --git a/Assets/Prefabs/Enemy Spawner.prefab b/Assets/Prefabs/Enemy Spawner.prefab new file mode 100644 index 0000000..4df3420 --- /dev/null +++ b/Assets/Prefabs/Enemy Spawner.prefab @@ -0,0 +1,55 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 0} + m_RootGameObject: {fileID: 1395176934816150} + m_IsPrefabAsset: 1 +--- !u!1 &1395176934816150 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 6 + m_Component: + - component: {fileID: 4558285466685174} + - component: {fileID: 114593873809628794} + m_Layer: 0 + m_Name: Enemy Spawner + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4558285466685174 +Transform: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1395176934816150} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -9, y: -1, 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!114 &114593873809628794 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1395176934816150} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 49c40f26c309ea34883e6f12fd857dc0, type: 3} + m_Name: + m_EditorClassIdentifier: + target: {fileID: 1747561760822266, guid: 6b8295ea9ddce6f49a598b9d52ee00df, type: 2} + period: 1 diff --git a/Assets/Prefabs/Enemy Spawner.prefab.meta b/Assets/Prefabs/Enemy Spawner.prefab.meta new file mode 100644 index 0000000..08f8f3f --- /dev/null +++ b/Assets/Prefabs/Enemy Spawner.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 540d1e36724b24c479d82ccc00b157bd +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Enemy.prefab b/Assets/Prefabs/Enemy.prefab index a0822af..47d40b5 100644 --- a/Assets/Prefabs/Enemy.prefab +++ b/Assets/Prefabs/Enemy.prefab @@ -22,6 +22,8 @@ GameObject: - component: {fileID: 212102337450718352} - component: {fileID: 114690864647000458} - component: {fileID: 114257029466335788} + - component: {fileID: 114721081660223792} + - component: {fileID: 65916037243695138} m_Layer: 0 m_Name: Enemy m_TagString: Untagged @@ -36,12 +38,24 @@ Transform: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 1747561760822266} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -9, y: -1, z: 0} + m_LocalPosition: {x: -6.942, y: -0.703, 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!65 &65916037243695138 +BoxCollider: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1747561760822266} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 0.31666666, y: 0.33333334, z: 0.2} + m_Center: {x: 0, y: 0.16666667, z: 0} --- !u!114 &114257029466335788 MonoBehaviour: m_ObjectHideFlags: 1 @@ -71,7 +85,7 @@ MonoBehaviour: - {x: -7, y: 2, z: 0} - {x: -5, y: 2, z: 0} - {x: -5, y: 0, z: 0} - - {x: -2, y: 0, z: 0} + - {x: -2.1, y: 0, z: 0} - {x: -2, y: 2, z: 0} - {x: 0, y: 2, z: 0} - {x: 0, y: -2, z: 0} @@ -80,7 +94,18 @@ MonoBehaviour: - {x: 2, y: -4, z: 0} - {x: 2, y: 0, z: 0} - {x: 4, y: 0, z: 0} - speed: 8 + speed: 6 +--- !u!114 &114721081660223792 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1747561760822266} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6128520e3bbd52845adc012369e21f79, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!212 &212102337450718352 SpriteRenderer: m_ObjectHideFlags: 1 @@ -116,7 +141,7 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 - m_Sprite: {fileID: 21300000, guid: d5ff12c405991e8499ef1dda13fcf028, type: 3} + m_Sprite: {fileID: 21300000, guid: d95a1a107ebf9ae47899c31611ea07c4, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 diff --git a/Assets/Prefabs/Large Enemy Spawner.prefab b/Assets/Prefabs/Large Enemy Spawner.prefab new file mode 100644 index 0000000..8ace9ac --- /dev/null +++ b/Assets/Prefabs/Large Enemy Spawner.prefab @@ -0,0 +1,55 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 0} + m_RootGameObject: {fileID: 1980775966905582} + m_IsPrefabAsset: 1 +--- !u!1 &1980775966905582 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 6 + m_Component: + - component: {fileID: 4107453902716502} + - component: {fileID: 114754729700265596} + m_Layer: 0 + m_Name: Large Enemy Spawner + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4107453902716502 +Transform: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1980775966905582} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -9, y: -1, 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!114 &114754729700265596 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1980775966905582} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 49c40f26c309ea34883e6f12fd857dc0, type: 3} + m_Name: + m_EditorClassIdentifier: + target: {fileID: 1740071194384892, guid: 20391aaa607560a41922769d7ad4ccd4, type: 2} + period: 5 diff --git a/Assets/Prefabs/Large Enemy Spawner.prefab.meta b/Assets/Prefabs/Large Enemy Spawner.prefab.meta new file mode 100644 index 0000000..622d9bb --- /dev/null +++ b/Assets/Prefabs/Large Enemy Spawner.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5314b7db1661a424f8ace9d11132af99 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Large Enemy.prefab b/Assets/Prefabs/Large Enemy.prefab new file mode 100644 index 0000000..20c63fa --- /dev/null +++ b/Assets/Prefabs/Large Enemy.prefab @@ -0,0 +1,170 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 0} + m_RootGameObject: {fileID: 1740071194384892} + m_IsPrefabAsset: 1 +--- !u!1 &1740071194384892 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 6 + m_Component: + - component: {fileID: 4768890038359228} + - component: {fileID: 212389100043825374} + - component: {fileID: 114593729714634686} + - component: {fileID: 114135330116060332} + - component: {fileID: 114219526184742858} + - component: {fileID: 61558333987601254} + m_Layer: 0 + m_Name: Large Enemy + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4768890038359228 +Transform: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1740071194384892} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -6.048, y: -0.111, 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!61 &61558333987601254 +BoxCollider2D: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1740071194384892} + 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.1666667} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0} + oldSize: {x: 0.65833336, y: 0.75} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 0.3333333, y: 0.3333333} + m_EdgeRadius: 0 +--- !u!114 &114135330116060332 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1740071194384892} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 33e6662e7a34a4d44ae78d2cc79ff439, type: 3} + m_Name: + m_EditorClassIdentifier: + path: + - {x: -7, y: -1, z: 0} + - {x: -7, y: 2, z: 0} + - {x: -5, y: 2, z: 0} + - {x: -5, y: 0, z: 0} + - {x: -2.1, y: 0, z: 0} + - {x: -2, y: 2, z: 0} + - {x: 0, y: 2, z: 0} + - {x: 0, y: -2, z: 0} + - {x: -5, y: -2, z: 0} + - {x: -5, y: -4, z: 0} + - {x: 2, y: -4, z: 0} + - {x: 2, y: 0, z: 0} + - {x: 4, y: 0, z: 0} + speed: 0.5 + rightSprite: {fileID: 21300000, guid: e5009608daa36d94a8503df4cd1a2218, type: 3} + upSprite: {fileID: 21300000, guid: f368801527547ab4d95ba0e14b74254c, type: 3} + downSprite: {fileID: 21300000, guid: d2b12f5669e7f894291d2cc6a9fa408d, type: 3} +--- !u!114 &114219526184742858 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1740071194384892} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6128520e3bbd52845adc012369e21f79, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &114593729714634686 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1740071194384892} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 709ff8451b4165d4d94bfb1b3b535b63, type: 3} + m_Name: + m_EditorClassIdentifier: + livesCost: 2 + health: 100 +--- !u!212 &212389100043825374 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1740071194384892} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + 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: e5009608daa36d94a8503df4cd1a2218, 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 diff --git a/Assets/Prefabs/Large Enemy.prefab.meta b/Assets/Prefabs/Large Enemy.prefab.meta new file mode 100644 index 0000000..b596d01 --- /dev/null +++ b/Assets/Prefabs/Large Enemy.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 20391aaa607560a41922769d7ad4ccd4 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 9a83935..b30747c 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -188,48 +188,6 @@ CanvasRenderer: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 244445659} m_CullTransparentMesh: 0 ---- !u!1 &280673607 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 280673609} - - component: {fileID: 280673608} - m_Layer: 0 - m_Name: Enemy Spawner - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &280673608 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 280673607} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 49c40f26c309ea34883e6f12fd857dc0, type: 3} - m_Name: - m_EditorClassIdentifier: - target: {fileID: 1747561760822266, guid: 6b8295ea9ddce6f49a598b9d52ee00df, type: 2} - period: 1 ---- !u!4 &280673609 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 280673607} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -9, y: -1, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 5 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &506261048 GameObject: m_ObjectHideFlags: 0 @@ -382,6 +340,48 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &863510027 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2} + propertyPath: m_LocalPosition.x + value: -9 + objectReference: {fileID: 0} + - target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2} + propertyPath: m_LocalPosition.y + value: -1 + objectReference: {fileID: 0} + - target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2} + propertyPath: m_RootOrder + value: 5 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2} + m_IsPrefabAsset: 0 --- !u!1 &972604241 GameObject: m_ObjectHideFlags: 0 @@ -496,6 +496,48 @@ Prefab: m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 75e554cdca74b174b8f51d9615688c48, type: 2} m_IsPrefabAsset: 0 +--- !u!1001 &1276082552 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2} + propertyPath: m_LocalPosition.x + value: -9 + objectReference: {fileID: 0} + - target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2} + propertyPath: m_LocalPosition.y + value: -1 + objectReference: {fileID: 0} + - target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2} + propertyPath: m_RootOrder + value: 6 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5314b7db1661a424f8ace9d11132af99, type: 2} + m_IsPrefabAsset: 0 --- !u!1001 &1559664665 Prefab: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/DepthFromY.cs b/Assets/Scripts/DepthFromY.cs index 0f4b76c..d0cc5e8 100644 --- a/Assets/Scripts/DepthFromY.cs +++ b/Assets/Scripts/DepthFromY.cs @@ -6,13 +6,9 @@ public class DepthFromY : MonoBehaviour { private SpriteRenderer spriteRenderer; - void Start () { + void Update () { spriteRenderer = gameObject.GetComponent(); spriteRenderer.sortingOrder = Mathf.CeilToInt(-transform.position.y * 100); } - - // Update is called once per frame - void Update () { - - } + } diff --git a/Assets/Scripts/EnemyMovement.cs b/Assets/Scripts/EnemyMovement.cs index 6516393..da7027a 100644 --- a/Assets/Scripts/EnemyMovement.cs +++ b/Assets/Scripts/EnemyMovement.cs @@ -9,14 +9,24 @@ public class EnemyMovement : MonoBehaviour { private int nextStop = 0; private GameStatus gameStatus; + private SongData songData; void Start () { gameStatus = GameObject.FindGameObjectWithTag("GameController").GetComponent(); + songData = GameObject.FindGameObjectWithTag("GameController").GetComponent(); } void Update () { - Vector3 newPosition = Vector3.MoveTowards(transform.position, path[nextStop], speed * Time.deltaTime); - if (Vector3.Distance(transform.position, newPosition) == 0) + Vector3 newPosition = Vector3.MoveTowards(transform.position, path[nextStop], speed * Mathf.Pow(Mathf.Sin(songData.songTime * Mathf.PI * songData.bpm / 60), 10) * Time.deltaTime); + if ((newPosition - transform.position).x < 0) + { + transform.localScale = new Vector3(-1, 1, 1); + } + else if ((newPosition - transform.position).x > 0) + { + transform.localScale = new Vector3(1, 1, 1); + } + if (Vector3.Distance(transform.position, path[nextStop]) == 0) { nextStop++; if (nextStop >= path.Length) diff --git a/Assets/Scripts/GameStatus.cs b/Assets/Scripts/GameStatus.cs index b532b7c..4a9ce6a 100644 --- a/Assets/Scripts/GameStatus.cs +++ b/Assets/Scripts/GameStatus.cs @@ -27,7 +27,6 @@ public class GameStatus : MonoBehaviour { public void EnemyFinishedPath(GameObject enemy) { - Debug.Log("Enemy reached target."); lives -= enemy.GetComponent().livesCost; Destroy(enemy); } diff --git a/Assets/Scripts/HatTower.cs b/Assets/Scripts/HatTower.cs index e10371e..5c3bb15 100644 --- a/Assets/Scripts/HatTower.cs +++ b/Assets/Scripts/HatTower.cs @@ -37,8 +37,6 @@ public class HatTower : MonoBehaviour { float power = Mathf.Pow(Mathf.Abs(Mathf.Cos(songData.songTime * Mathf.PI * songData.bpm / 30)), 2); //Play the sound hatSource.Play(); - //Log the power to console - Debug.Log(power.ToString("0.00")); //Start the cooldown cooldownRemaining = cooldown; //Change the sprite diff --git a/Assets/Scripts/InstantiateEverySeconds.cs b/Assets/Scripts/InstantiateEverySeconds.cs index 0537402..7842161 100644 --- a/Assets/Scripts/InstantiateEverySeconds.cs +++ b/Assets/Scripts/InstantiateEverySeconds.cs @@ -13,7 +13,7 @@ public class InstantiateEverySeconds : MonoBehaviour { cooldown -= Time.deltaTime; if (cooldown <= 0) { - Instantiate(target); + Instantiate(target, transform.position, transform.rotation); cooldown = period; } } diff --git a/Assets/Scripts/KickTower.cs b/Assets/Scripts/KickTower.cs index 82f7917..2105302 100644 --- a/Assets/Scripts/KickTower.cs +++ b/Assets/Scripts/KickTower.cs @@ -37,8 +37,6 @@ public class KickTower : MonoBehaviour { float power = Mathf.Pow(Mathf.Abs(Mathf.Cos(songData.songTime * Mathf.PI * songData.bpm / 120)), 2); //Play the sound kickSource.Play(); - //Log the power to console - Debug.Log(power.ToString("0.00")); //Start the cooldown cooldownRemaining = cooldown; //Change the sprite diff --git a/Assets/Scripts/LargeEnemyMovement.cs b/Assets/Scripts/LargeEnemyMovement.cs new file mode 100644 index 0000000..41b305e --- /dev/null +++ b/Assets/Scripts/LargeEnemyMovement.cs @@ -0,0 +1,59 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class LargeEnemyMovement : MonoBehaviour { + + public Vector3[] path; + public float speed = 1; + + public Sprite rightSprite; + public Sprite upSprite; + public Sprite downSprite; + + private int nextStop = 0; + private GameStatus gameStatus; + private SongData songData; + private SpriteRenderer spriteRenderer; + + void Start () { + gameStatus = GameObject.FindGameObjectWithTag("GameController").GetComponent(); + songData = GameObject.FindGameObjectWithTag("GameController").GetComponent(); + spriteRenderer = gameObject.GetComponent(); + } + + void Update () { + Vector3 newPosition = Vector3.MoveTowards(transform.position, path[nextStop], speed * Mathf.Pow(Mathf.Sin(songData.songTime * Mathf.PI * songData.bpm / 240), 2) * Time.deltaTime); + Vector3 difference = newPosition - transform.position; + if (difference.y > 0) + { + spriteRenderer.sprite = upSprite; + } + else if (difference.y < -0) + { + spriteRenderer.sprite = downSprite; + } + else + { + spriteRenderer.sprite = rightSprite; + } + + if (difference.x < 0) + { + transform.localScale = new Vector3(-1, 1, 1); + } + else if (difference.x > 0) + { + transform.localScale = new Vector3(1, 1, 1); + } + if (Vector3.Distance(transform.position, path[nextStop]) == 0) + { + nextStop++; + if (nextStop >= path.Length) + { + gameStatus.EnemyFinishedPath(gameObject); + } + } + transform.position = newPosition; + } +} diff --git a/Assets/Scripts/LargeEnemyMovement.cs.meta b/Assets/Scripts/LargeEnemyMovement.cs.meta new file mode 100644 index 0000000..e8204dd --- /dev/null +++ b/Assets/Scripts/LargeEnemyMovement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 33e6662e7a34a4d44ae78d2cc79ff439 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SnareTower.cs b/Assets/Scripts/SnareTower.cs index 5168225..4918080 100644 --- a/Assets/Scripts/SnareTower.cs +++ b/Assets/Scripts/SnareTower.cs @@ -37,8 +37,6 @@ public class SnareTower : MonoBehaviour { float power = Mathf.Pow(Mathf.Abs(Mathf.Sin(songData.songTime * Mathf.PI * songData.bpm / 120)), 2); //Play the sound snareSource.Play(); - //Log the power to console - Debug.Log(power.ToString("0.00")); //Start the cooldown cooldownRemaining = cooldown; //Change the sprite diff --git a/Assets/Sprites/enemy1.png.meta b/Assets/Sprites/enemy1.png.meta index 07f1be8..ebb6737 100644 --- a/Assets/Sprites/enemy1.png.meta +++ b/Assets/Sprites/enemy1.png.meta @@ -43,7 +43,7 @@ TextureImporter: spriteMode: 1 spriteExtrude: 1 spriteMeshType: 1 - alignment: 0 + alignment: 7 spritePivot: {x: 0.5, y: 0.5} spritePixelsToUnits: 120 spriteBorder: {x: 0, y: 0, z: 0, w: 0} diff --git a/Assets/Sprites/enemy2.png.meta b/Assets/Sprites/enemy2.png.meta index 72eaf63..a3af51f 100644 --- a/Assets/Sprites/enemy2.png.meta +++ b/Assets/Sprites/enemy2.png.meta @@ -43,8 +43,8 @@ TextureImporter: spriteMode: 1 spriteExtrude: 1 spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} + alignment: 7 + spritePivot: {x: 0.5, y: 0} spritePixelsToUnits: 120 spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteGenerateFallbackPhysicsShape: 1 diff --git a/Assets/Sprites/enemy2back.png.meta b/Assets/Sprites/enemy2back.png.meta index 7d218ec..2d279a3 100644 --- a/Assets/Sprites/enemy2back.png.meta +++ b/Assets/Sprites/enemy2back.png.meta @@ -43,7 +43,7 @@ TextureImporter: spriteMode: 1 spriteExtrude: 1 spriteMeshType: 1 - alignment: 0 + alignment: 7 spritePivot: {x: 0.5, y: 0.5} spritePixelsToUnits: 120 spriteBorder: {x: 0, y: 0, z: 0, w: 0} diff --git a/Assets/Sprites/enemy2front.png.meta b/Assets/Sprites/enemy2front.png.meta index 5c7ba2d..2e13422 100644 --- a/Assets/Sprites/enemy2front.png.meta +++ b/Assets/Sprites/enemy2front.png.meta @@ -43,7 +43,7 @@ TextureImporter: spriteMode: 1 spriteExtrude: 1 spriteMeshType: 1 - alignment: 0 + alignment: 7 spritePivot: {x: 0.5, y: 0.5} spritePixelsToUnits: 120 spriteBorder: {x: 0, y: 0, z: 0, w: 0}