diff --git a/Assets/Prefabs/CameraRig.prefab b/Assets/Prefabs/CameraRig.prefab index 6f2b495..f765955 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,16 @@ MonoBehaviour: m_EditorClassIdentifier: Wave: 0 difficulty: 1 - difficultyIncreasePerWave: 0.75 - WaveTime: 5 + difficultyIncreasePerWave: 0.25 + difficultyMultiplyDecreasePerWave: 0.1 + WaveTime: 20 enemyDifficulties: [] - SpawnRadius: 17.8 + SpawnRadius: 22.6 NumEnemies: 6 players: - {fileID: 0} - {fileID: 0} + initialSpawnDelay: 5 enemyList: [] --- !u!1 &2607936989766580656 GameObject: @@ -222,7 +224,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 +248,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 +262,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 +278,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 +325,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 +431,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 +478,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 36fb7ad..9634d8a 100644 --- a/Assets/Scenes/GameScene.unity +++ b/Assets/Scenes/GameScene.unity @@ -1600,7 +1600,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: @@ -1767,7 +1770,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: @@ -1876,6 +1882,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 @@ -3371,6 +3390,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 @@ -3766,66 +3798,14 @@ 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: 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: 0.9979528 - objectReference: {fileID: 0} - - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalRotation.x - value: 0.0030935924 - objectReference: {fileID: 0} - - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalRotation.y - value: 0.06388009 - objectReference: {fileID: 0} - - target: {fileID: 3197454023887695364, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalRotation.z - value: -0.00019802434 - 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: players.Array.data[0] value: @@ -3834,10 +3814,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 @@ -3882,30 +3858,6 @@ 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: 0.9979528 - objectReference: {fileID: 0} - - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalRotation.x - value: 0.0030935924 - objectReference: {fileID: 0} - - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalRotation.y - value: 0.06388009 - objectReference: {fileID: 0} - - target: {fileID: 8946450710138871461, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - propertyPath: m_LocalRotation.z - value: -0.00019802434 - objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs b/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs index 9b924ca..0d88a5c 100644 --- a/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs +++ b/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs @@ -8,19 +8,21 @@ using Unity.VisualScripting; using UnityEngine; using UnityEngine.UIElements; -public class NewBehaviourScript : MonoBehaviour +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; [SerializeField] private int NumEnemies = 6; [SerializeField] private GameObject[] players; + [SerializeField] private float initialSpawnDelay = 5; // Private private bool nextWaveRequested = false; @@ -41,6 +43,8 @@ public class NewBehaviourScript : MonoBehaviour enemyList.Add(new EnemyPrefabInfo() { Difficulty = i+1, prefabs = Resources.LoadAll("Enemies/" + (i+1)) }); } + timer = WaveTime - initialSpawnDelay; + StartSpawning(); } @@ -56,7 +60,11 @@ public class NewBehaviourScript : MonoBehaviour SpawnWave(difficulty); Wave++; - difficulty *= difficultyIncreasePerWave + 1; + if (difficultyIncreasePerWave > 1f) + { + difficultyIncreasePerWave -= difficultyMultiplyDecreasePerWave; + difficulty *= difficultyIncreasePerWave + 1; + } nextWaveRequested = false; timer = 0; } @@ -93,6 +101,7 @@ public class NewBehaviourScript : 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(); 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: 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; }