From 9c40dec24fb1f33c905657947aa4a11d09963e4a Mon Sep 17 00:00:00 2001 From: BOT Alex <44818698+MagicBOTAlex@users.noreply.github.com> Date: Sun, 4 Feb 2024 00:04:21 +0100 Subject: [PATCH 1/6] Fixed camera rotation --- Assets/Scenes/GameScene.unity | 48 +++++++++++++++---- .../Scripts/Extensions/ClampCameraRotation.cs | 26 ++++++++++ .../Extensions/ClampCameraRotation.cs.meta | 11 +++++ 3 files changed, 76 insertions(+), 9 deletions(-) create mode 100644 Assets/Scripts/Extensions/ClampCameraRotation.cs create mode 100644 Assets/Scripts/Extensions/ClampCameraRotation.cs.meta diff --git a/Assets/Scenes/GameScene.unity b/Assets/Scenes/GameScene.unity index 69e0e05..8723d76 100644 --- a/Assets/Scenes/GameScene.unity +++ b/Assets/Scenes/GameScene.unity @@ -1497,6 +1497,25 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 880679715} m_CullTransparentMesh: 1 +--- !u!1 &1105072965 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 6306269600238927148, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} + m_PrefabInstance: {fileID: 5796191506433166633} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1105072968 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1105072965} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 38fb1d450df272f49b06540bb0a4ab88, type: 3} + m_Name: + m_EditorClassIdentifier: + MinPitch: 0 + MaxPitch: 0 --- !u!4 &1194834060 stripped Transform: m_CorrespondingSourceObject: {fileID: 320690117028550720, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} @@ -3438,6 +3457,14 @@ PrefabInstance: propertyPath: orthographic size value: 12.5 objectReference: {fileID: 0} + - target: {fileID: 1655227407111773373, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} + propertyPath: m_BindingMode + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1655227407111773373, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} + propertyPath: m_AngularDampingMode + value: 0 + objectReference: {fileID: 0} - target: {fileID: 1873901299772310795, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_MinimumOrthoSize value: 12.5 @@ -3460,19 +3487,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.w - value: 0.9979528 + value: 0.9979576 objectReference: {fileID: 0} - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.x - value: 0.0030935924 + value: 9.296001e-13 objectReference: {fileID: 0} - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.y - value: 0.06388009 + value: 0.06388041 objectReference: {fileID: 0} - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.z - value: -0.00019802434 + value: 1.4522473e-11 objectReference: {fileID: 0} - target: {fileID: 3401975006071930001, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_Targets.Array.data[0].radius @@ -3560,24 +3587,27 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.w - value: 0.9979528 + value: 0.9979576 objectReference: {fileID: 0} - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.x - value: 0.0030935924 + value: 9.296001e-13 objectReference: {fileID: 0} - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.y - value: 0.06388009 + value: 0.06388041 objectReference: {fileID: 0} - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.z - value: -0.00019802434 + value: 1.4522473e-11 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 6306269600238927148, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} + insertIndex: -1 + addedObject: {fileID: 1105072968} m_SourcePrefab: {fileID: 100100000, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} --- !u!1001 &7693964683212020007 PrefabInstance: diff --git a/Assets/Scripts/Extensions/ClampCameraRotation.cs b/Assets/Scripts/Extensions/ClampCameraRotation.cs new file mode 100644 index 0000000..c63d958 --- /dev/null +++ b/Assets/Scripts/Extensions/ClampCameraRotation.cs @@ -0,0 +1,26 @@ +using UnityEngine; +using Cinemachine; + +[AddComponentMenu("")] // Hide in menu - use extensions menu +[SaveDuringPlay] +[ExecuteAlways] +public class ClampCameraRotation : CinemachineExtension +{ + public float MinPitch = -20; + public float MaxPitch = 20; + + protected override void PostPipelineStageCallback( + CinemachineVirtualCameraBase vcam, + CinemachineCore.Stage stage, ref CameraState state, float deltaTime) + { + if (stage == CinemachineCore.Stage.Aim) + { + var rot = state.RawOrientation.eulerAngles; + rot.x = Mathf.Clamp(rot.x, MinPitch, MaxPitch); + rot.y = Mathf.Clamp(rot.y, MinPitch, MaxPitch); + rot.z = Mathf.Clamp(rot.z, MinPitch, MaxPitch); + state.RawOrientation = Quaternion.Euler(rot); + } + } +} + diff --git a/Assets/Scripts/Extensions/ClampCameraRotation.cs.meta b/Assets/Scripts/Extensions/ClampCameraRotation.cs.meta new file mode 100644 index 0000000..885f224 --- /dev/null +++ b/Assets/Scripts/Extensions/ClampCameraRotation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 38fb1d450df272f49b06540bb0a4ab88 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 6f4cb671861cc2c6201f0d6cff3bec49ae49e210 Mon Sep 17 00:00:00 2001 From: BOT Alex <44818698+MagicBOTAlex@users.noreply.github.com> Date: Sun, 4 Feb 2024 00:08:51 +0100 Subject: [PATCH 2/6] Starts spawning enemies faster --- Assets/Prefabs/CameraRig.prefab | 42 +++++++++++++------ Assets/Scenes/GameScene.unity | 20 +++++---- .../Controller/EnemySpawner/EnemySpawner.cs | 5 ++- 3 files changed, 45 insertions(+), 22 deletions(-) diff --git a/Assets/Prefabs/CameraRig.prefab b/Assets/Prefabs/CameraRig.prefab index 6f2b495..5ddc813 100644 --- a/Assets/Prefabs/CameraRig.prefab +++ b/Assets/Prefabs/CameraRig.prefab @@ -29,8 +29,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2173372557174057003} serializedVersion: 2 - m_LocalRotation: {x: 0.010014362, y: 0.025269484, z: -0.0002531513, w: 0.9996305} - m_LocalPosition: {x: -4.3259, y: -19.329144, z: -10} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -13.048559, y: -19.467272, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -71,7 +71,7 @@ Camera: far clip plane: 5000 field of view: 60.000004 orthographic: 1 - orthographic size: 7.5 + orthographic size: 12.5 m_Depth: 0 m_CullingMask: serializedVersion: 2 @@ -187,14 +187,15 @@ MonoBehaviour: m_EditorClassIdentifier: Wave: 0 difficulty: 1 - difficultyIncreasePerWave: 0.75 - WaveTime: 5 + difficultyIncreasePerWave: 0.25 + WaveTime: 20 enemyDifficulties: [] - SpawnRadius: 17.8 + SpawnRadius: 22.6 NumEnemies: 6 players: - {fileID: 0} - {fileID: 0} + initialSpawnDelay: 0 enemyList: [] --- !u!1 &2607936989766580656 GameObject: @@ -222,7 +223,7 @@ Transform: m_GameObject: {fileID: 2607936989766580656} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -4.3259, y: -19.329144, z: 0} + m_LocalPosition: {x: -13.048559, y: -19.467272, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -246,10 +247,10 @@ MonoBehaviour: m_Targets: - target: {fileID: 0} weight: 1 - radius: 2 + radius: 3 - target: {fileID: 0} weight: 1 - radius: 2 + radius: 3 --- !u!1 &6306269600238927148 GameObject: m_ObjectHideFlags: 0 @@ -260,6 +261,7 @@ GameObject: m_Component: - component: {fileID: 3197454023887695364} - component: {fileID: 1945378220081163713} + - component: {fileID: 4060518028321021500} m_Layer: 0 m_Name: Virtual Camera m_TagString: Untagged @@ -275,8 +277,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6306269600238927148} serializedVersion: 2 - m_LocalRotation: {x: 0.010014362, y: 0.025269484, z: -0.0002531513, w: 0.9996305} - m_LocalPosition: {x: -4.3259, y: -19.329144, z: -10} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -13.048559, y: -19.467272, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: @@ -322,6 +324,20 @@ MonoBehaviour: m_Calls: [] m_LegacyBlendHint: 0 m_ComponentOwner: {fileID: 4498264854370183204} +--- !u!114 &4060518028321021500 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6306269600238927148} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 38fb1d450df272f49b06540bb0a4ab88, type: 3} + m_Name: + m_EditorClassIdentifier: + MinPitch: 0 + MaxPitch: 0 --- !u!1 &6455280833853463581 GameObject: m_ObjectHideFlags: 0 @@ -414,7 +430,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fa7155796051b734daa718462081dc5f, type: 3} m_Name: m_EditorClassIdentifier: - m_BindingMode: 3 + m_BindingMode: 1 m_FollowOffset: {x: 0, y: 0, z: -10} m_XDamping: 1 m_YDamping: 1 @@ -461,5 +477,5 @@ MonoBehaviour: m_MaximumDistance: 5000 m_MinimumFOV: 3 m_MaximumFOV: 60 - m_MinimumOrthoSize: 7.5 + m_MinimumOrthoSize: 12.5 m_MaximumOrthoSize: 5000 diff --git a/Assets/Scenes/GameScene.unity b/Assets/Scenes/GameScene.unity index 8723d76..5c21958 100644 --- a/Assets/Scenes/GameScene.unity +++ b/Assets/Scenes/GameScene.unity @@ -3487,19 +3487,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.w - value: 0.9979576 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.x - value: 9.296001e-13 + value: -0 objectReference: {fileID: 0} - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.y - value: 0.06388041 + value: -0 objectReference: {fileID: 0} - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.z - value: 1.4522473e-11 + value: -0 objectReference: {fileID: 0} - target: {fileID: 3401975006071930001, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_Targets.Array.data[0].radius @@ -3521,6 +3521,10 @@ PrefabInstance: propertyPath: WaveTime value: 20 objectReference: {fileID: 0} + - target: {fileID: 3603265075407754381, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} + propertyPath: SpawnRadius + value: 22.6 + objectReference: {fileID: 0} - target: {fileID: 3603265075407754381, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: players.Array.data[0] value: @@ -3587,19 +3591,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.w - value: 0.9979576 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.x - value: 9.296001e-13 + value: -0 objectReference: {fileID: 0} - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.y - value: 0.06388041 + value: -0 objectReference: {fileID: 0} - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalRotation.z - value: 1.4522473e-11 + value: -0 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] diff --git a/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs b/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs index 9b924ca..afeabeb 100644 --- a/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs +++ b/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs @@ -8,7 +8,7 @@ using Unity.VisualScripting; using UnityEngine; using UnityEngine.UIElements; -public class NewBehaviourScript : MonoBehaviour +public class EnemySpawner : MonoBehaviour { // Shared public int Wave = 0; @@ -21,6 +21,7 @@ public class NewBehaviourScript : MonoBehaviour [SerializeField] private float SpawnRadius = 10; [SerializeField] private int NumEnemies = 6; [SerializeField] private GameObject[] players; + [SerializeField] private float initialSpawnDelay = 5; // Private private bool nextWaveRequested = false; @@ -41,6 +42,8 @@ public class NewBehaviourScript : MonoBehaviour enemyList.Add(new EnemyPrefabInfo() { Difficulty = i+1, prefabs = Resources.LoadAll("Enemies/" + (i+1)) }); } + timer = WaveTime - initialSpawnDelay; + StartSpawning(); } From 0be229e41b0c4642e3c2301987e780ceb5f44e82 Mon Sep 17 00:00:00 2001 From: BOT Alex <44818698+MagicBOTAlex@users.noreply.github.com> Date: Sun, 4 Feb 2024 00:16:27 +0100 Subject: [PATCH 3/6] Tweaked spawning speed --- Assets/Scenes/GameScene.unity | 116 +----------------- .../Controller/EnemySpawner/EnemySpawner.cs | 9 +- 2 files changed, 10 insertions(+), 115 deletions(-) diff --git a/Assets/Scenes/GameScene.unity b/Assets/Scenes/GameScene.unity index 5c21958..4301c38 100644 --- a/Assets/Scenes/GameScene.unity +++ b/Assets/Scenes/GameScene.unity @@ -1497,25 +1497,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 880679715} m_CullTransparentMesh: 1 ---- !u!1 &1105072965 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 6306269600238927148, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - m_PrefabInstance: {fileID: 5796191506433166633} - m_PrefabAsset: {fileID: 0} ---- !u!114 &1105072968 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1105072965} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 38fb1d450df272f49b06540bb0a4ab88, type: 3} - m_Name: - m_EditorClassIdentifier: - MinPitch: 0 - MaxPitch: 0 --- !u!4 &1194834060 stripped Transform: m_CorrespondingSourceObject: {fileID: 320690117028550720, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} @@ -3453,77 +3434,17 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 1609280383408315754, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: orthographic size - value: 12.5 - objectReference: {fileID: 0} - - target: {fileID: 1655227407111773373, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_BindingMode - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1655227407111773373, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_AngularDampingMode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1873901299772310795, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_MinimumOrthoSize - value: 12.5 - objectReference: {fileID: 0} - - target: {fileID: 2849751201525768572, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalPosition.x - value: -13.048559 - objectReference: {fileID: 0} - - target: {fileID: 2849751201525768572, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalPosition.y - value: -19.467272 - objectReference: {fileID: 0} - - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalPosition.x - value: -13.048559 - objectReference: {fileID: 0} - - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalPosition.y - value: -19.467272 - objectReference: {fileID: 0} - - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 3401975006071930001, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_Targets.Array.data[0].radius - value: 3 - objectReference: {fileID: 0} - target: {fileID: 3401975006071930001, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_Targets.Array.data[0].target value: objectReference: {fileID: 1232208440} - - target: {fileID: 3401975006071930001, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_Targets.Array.data[1].radius - value: 3 - objectReference: {fileID: 0} - target: {fileID: 3401975006071930001, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_Targets.Array.data[1].target value: objectReference: {fileID: 1194834060} - target: {fileID: 3603265075407754381, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: WaveTime - value: 20 - objectReference: {fileID: 0} - - target: {fileID: 3603265075407754381, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: SpawnRadius - value: 22.6 + propertyPath: initialSpawnDelay + value: 5 objectReference: {fileID: 0} - target: {fileID: 3603265075407754381, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: players.Array.data[0] @@ -3533,10 +3454,6 @@ PrefabInstance: propertyPath: players.Array.data[1] value: objectReference: {fileID: 1579580564} - - target: {fileID: 3603265075407754381, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: difficultyIncreasePerWave - value: 0.25 - objectReference: {fileID: 0} - target: {fileID: 5959206239141280122, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -3581,37 +3498,10 @@ PrefabInstance: propertyPath: m_Name value: CameraRig objectReference: {fileID: 0} - - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalPosition.x - value: -13.048559 - objectReference: {fileID: 0} - - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalPosition.y - value: -19.467272 - objectReference: {fileID: 0} - - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: - - targetCorrespondingSourceObject: {fileID: 6306269600238927148, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - insertIndex: -1 - addedObject: {fileID: 1105072968} + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} --- !u!1001 &7693964683212020007 PrefabInstance: diff --git a/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs b/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs index afeabeb..28421cd 100644 --- a/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs +++ b/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs @@ -12,10 +12,11 @@ public class EnemySpawner : MonoBehaviour { // Shared public int Wave = 0; - public float difficulty = 1; + public float difficulty = 1f; // Inspector [SerializeField] private float difficultyIncreasePerWave = 0.1f; + [SerializeField] private float difficultyMultiplyDecreasePerWave = 0.1f; [SerializeField] private float WaveTime = 20f; [SerializeField] private List enemyDifficulties; [SerializeField] private float SpawnRadius = 10; @@ -59,7 +60,11 @@ public class EnemySpawner : MonoBehaviour SpawnWave(difficulty); Wave++; - difficulty *= difficultyIncreasePerWave + 1; + if (difficultyIncreasePerWave > 1f) + { + difficultyIncreasePerWave -= difficultyMultiplyDecreasePerWave; + difficulty *= difficultyIncreasePerWave + 1; + } nextWaveRequested = false; timer = 0; } From d107a523e949bfc836f869a0a828b33193f18251 Mon Sep 17 00:00:00 2001 From: BOT Alex <44818698+MagicBOTAlex@users.noreply.github.com> Date: Sun, 4 Feb 2024 00:17:12 +0100 Subject: [PATCH 4/6] Update CameraRig.prefab --- Assets/Prefabs/CameraRig.prefab | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Assets/Prefabs/CameraRig.prefab b/Assets/Prefabs/CameraRig.prefab index 5ddc813..f765955 100644 --- a/Assets/Prefabs/CameraRig.prefab +++ b/Assets/Prefabs/CameraRig.prefab @@ -188,6 +188,7 @@ MonoBehaviour: Wave: 0 difficulty: 1 difficultyIncreasePerWave: 0.25 + difficultyMultiplyDecreasePerWave: 0.1 WaveTime: 20 enemyDifficulties: [] SpawnRadius: 22.6 @@ -195,7 +196,7 @@ MonoBehaviour: players: - {fileID: 0} - {fileID: 0} - initialSpawnDelay: 0 + initialSpawnDelay: 5 enemyList: [] --- !u!1 &2607936989766580656 GameObject: From d78cb670c27576e5bfcad794d6b22bcf0971da62 Mon Sep 17 00:00:00 2001 From: BOT Alex <44818698+MagicBOTAlex@users.noreply.github.com> Date: Sun, 4 Feb 2024 00:19:01 +0100 Subject: [PATCH 5/6] Fixed player sprite anim --- Assets/Scenes/GameScene.unity | 40 ++++++++++++++++--- .../Scripts/Player/SpriteMovementFlipper.cs | 4 +- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/Assets/Scenes/GameScene.unity b/Assets/Scenes/GameScene.unity index 4301c38..8cf984f 100644 --- a/Assets/Scenes/GameScene.unity +++ b/Assets/Scenes/GameScene.unity @@ -1398,7 +1398,10 @@ PrefabInstance: m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 3120938410244321186, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} + insertIndex: -1 + addedObject: {fileID: 1579580571} m_SourcePrefab: {fileID: 100100000, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} --- !u!114 &869964774 stripped MonoBehaviour: @@ -1565,7 +1568,10 @@ PrefabInstance: m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 3120938410244321186, guid: 99a6ff8b9591949439b620b13bd249a4, type: 3} + insertIndex: -1 + addedObject: {fileID: 1254139636} m_SourcePrefab: {fileID: 100100000, guid: 99a6ff8b9591949439b620b13bd249a4, type: 3} --- !u!114 &1232208433 stripped MonoBehaviour: @@ -1674,6 +1680,19 @@ GameObject: m_CorrespondingSourceObject: {fileID: 3120938410244321186, guid: 99a6ff8b9591949439b620b13bd249a4, type: 3} m_PrefabInstance: {fileID: 1232208432} m_PrefabAsset: {fileID: 0} +--- !u!114 &1254139636 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1254139629} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3} + m_Name: + m_EditorClassIdentifier: + invert: 0 --- !u!1 &1377274208 GameObject: m_ObjectHideFlags: 0 @@ -3039,6 +3058,19 @@ GameObject: m_CorrespondingSourceObject: {fileID: 3120938410244321186, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} m_PrefabInstance: {fileID: 869964773} m_PrefabAsset: {fileID: 0} +--- !u!114 &1579580571 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1579580564} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3} + m_Name: + m_EditorClassIdentifier: + invert: 0 --- !u!1 &1600052931 GameObject: m_ObjectHideFlags: 0 @@ -3442,10 +3474,6 @@ PrefabInstance: propertyPath: m_Targets.Array.data[1].target value: objectReference: {fileID: 1194834060} - - target: {fileID: 3603265075407754381, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: initialSpawnDelay - value: 5 - objectReference: {fileID: 0} - target: {fileID: 3603265075407754381, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} propertyPath: players.Array.data[0] value: diff --git a/Assets/Scripts/Player/SpriteMovementFlipper.cs b/Assets/Scripts/Player/SpriteMovementFlipper.cs index 5db92fe..64b8105 100644 --- a/Assets/Scripts/Player/SpriteMovementFlipper.cs +++ b/Assets/Scripts/Player/SpriteMovementFlipper.cs @@ -15,11 +15,11 @@ public class SpriteMovementFlipper : MonoBehaviour private void Update() { - if ((transform.position - prevPos).x > 0.1f) + if ((transform.position - prevPos).x > 0.05f) { sp.flipX = invert; } - else if ((transform.position - prevPos).x < -0.1f) + else if ((transform.position - prevPos).x < -0.05f) { sp.flipX = !invert; } From 52b8a8ccff124dd348d0b0942c72bbb987549143 Mon Sep 17 00:00:00 2001 From: BOT Alex <44818698+MagicBOTAlex@users.noreply.github.com> Date: Sun, 4 Feb 2024 00:26:32 +0100 Subject: [PATCH 6/6] I hope i fixed first wave spawn --- Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs b/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs index 28421cd..0d88a5c 100644 --- a/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs +++ b/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs @@ -101,6 +101,7 @@ public class EnemySpawner : MonoBehaviour void SpawnRandom(float difficulty) { + difficulty *= 1.1f; while (difficulty > 1f) // Spawn until difficulty is less than 0.5f { var validEnemies = enemyList.Where(x => x.Difficulty <= difficulty).ToArray();