diff --git a/Assets/Scenes/Level1.unity b/Assets/Scenes/Level1.unity index 53024b6..55b147a 100644 --- a/Assets/Scenes/Level1.unity +++ b/Assets/Scenes/Level1.unity @@ -6383,6 +6383,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: player: {fileID: 685738189} + smoothing: 0.6 --- !u!20 &519420031 Camera: m_ObjectHideFlags: 0 @@ -37371,7 +37372,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2011940723} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: -8, z: 0} + m_LocalPosition: {x: 0, y: -12.5, z: 0} m_LocalScale: {x: 1000, y: 1, z: 1} m_Children: [] m_Father: {fileID: 230892770} diff --git a/Assets/Scenes/Level3.unity b/Assets/Scenes/Level3.unity index 4e6019b..e9e028d 100644 --- a/Assets/Scenes/Level3.unity +++ b/Assets/Scenes/Level3.unity @@ -844,6 +844,156 @@ MonoBehaviour: blendDistance: 0 weight: 1 sharedProfile: {fileID: 11400000, guid: f293c0209739a5248b5cf4f586e42777, type: 2} +--- !u!1 &509178258 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 509178259} + - component: {fileID: 509178263} + - component: {fileID: 509178262} + - component: {fileID: 509178261} + - component: {fileID: 509178260} + m_Layer: 3 + m_Name: Floor (5) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &509178259 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 509178258} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 106.3, y: 11, z: 0.70835644} + m_LocalScale: {x: 30, y: 2, z: 1} + m_Children: [] + m_Father: {fileID: 1985907937} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &509178260 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 509178258} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4366df60f8ac7f428d235d55b5dfc13, type: 3} + m_Name: + m_EditorClassIdentifier: + rotation_center: {fileID: 822468336} + static_center: 1 + right_rotation: 1 + flipping: 1 + speed: 0.2 + flip_angle: 3 +--- !u!50 &509178261 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 509178258} + m_BodyType: 2 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 6200000, guid: 2c0538ecede9d3b43867ca45f72ba04b, type: 2} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!61 &509178262 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 509178258} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 6200000, guid: 2c0538ecede9d3b43867ca45f72ba04b, type: 2} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1, y: 1} + m_EdgeRadius: 0 +--- !u!212 &509178263 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 509178258} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3} + m_Color: {r: 0, g: 1, b: 0.5628011, 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!1 &519420028 GameObject: m_ObjectHideFlags: 0 @@ -885,6 +1035,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: player: {fileID: 685738189} + smoothing: 0.6 --- !u!20 &519420031 Camera: m_ObjectHideFlags: 0 @@ -912,7 +1063,7 @@ Camera: far clip plane: 1000 field of view: 60 orthographic: 1 - orthographic size: 8 + orthographic size: 10.034308 m_Depth: -1 m_CullingMask: serializedVersion: 2 @@ -6990,6 +7141,156 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 1, y: 1} m_EdgeRadius: 0 +--- !u!1 &1536933197 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1536933198} + - component: {fileID: 1536933202} + - component: {fileID: 1536933201} + - component: {fileID: 1536933200} + - component: {fileID: 1536933199} + m_Layer: 3 + m_Name: Floor (6) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1536933198 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1536933197} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 95, y: 23.9, z: 0.70835644} + m_LocalScale: {x: 30, y: 2, z: 1} + m_Children: [] + m_Father: {fileID: 1985907937} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1536933199 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1536933197} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4366df60f8ac7f428d235d55b5dfc13, type: 3} + m_Name: + m_EditorClassIdentifier: + rotation_center: {fileID: 822468336} + static_center: 1 + right_rotation: 1 + flipping: 1 + speed: 0.2 + flip_angle: 3 +--- !u!50 &1536933200 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1536933197} + m_BodyType: 2 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 6200000, guid: 2c0538ecede9d3b43867ca45f72ba04b, type: 2} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!61 &1536933201 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1536933197} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 6200000, guid: 2c0538ecede9d3b43867ca45f72ba04b, type: 2} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1, y: 1} + m_EdgeRadius: 0 +--- !u!212 &1536933202 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1536933197} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3} + m_Color: {r: 0, g: 1, b: 0.5628011, 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!1 &1579585631 GameObject: m_ObjectHideFlags: 0 @@ -7693,6 +7994,8 @@ Transform: - {fileID: 1919170708} - {fileID: 246033625} - {fileID: 109409226} + - {fileID: 509178259} + - {fileID: 1536933198} m_Father: {fileID: 343801489} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scenes/Level4.unity b/Assets/Scenes/Level4.unity index d9c5016..13a69e0 100644 --- a/Assets/Scenes/Level4.unity +++ b/Assets/Scenes/Level4.unity @@ -6256,6 +6256,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: player: {fileID: 685738189} + smoothing: 0.6 --- !u!20 &519420031 Camera: m_ObjectHideFlags: 0 @@ -37936,7 +37937,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1750757246} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -43.6, y: 109.9, z: 0} + m_LocalPosition: {x: -43.6, y: 130.3, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 883602336} diff --git a/Assets/Scripts/CameraTracking.cs b/Assets/Scripts/CameraTracking.cs index 4144d4e..6d2c762 100644 --- a/Assets/Scripts/CameraTracking.cs +++ b/Assets/Scripts/CameraTracking.cs @@ -5,18 +5,36 @@ using UnityEngine; public class CameraTracking : MonoBehaviour { public Transform player; + [Range(0.1f, 2)] [SerializeField] float smoothing = 0.6f; // Start is called before the first frame update + + Vector3 player_pos; + Vector3 camera_pos; + Vector2 difference = new Vector2(0, 0); + void Start() { - + camera_pos = transform.position; + + camera_pos[2] = -10; + + transform.position = camera_pos; } // Update is called once per frame void Update() { - Vector3 playpos = player.transform.position; - playpos.z = playpos.z - 10; - playpos.y = playpos.y + 3; - transform.position = playpos; + player_pos = player.transform.position; + camera_pos = transform.position; + + difference[0] = player_pos[0] - camera_pos[0]; + difference[1] = player_pos[1] - camera_pos[1]; + + float smoothing_ = smoothing / Time.deltaTime; + + camera_pos[0] += difference[0] / smoothing_; + camera_pos[1] += difference[1] / smoothing_; + + transform.position = camera_pos; } } diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index c77fb7b..802601d 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -12,26 +12,26 @@ EditorUserSettings: value: 22424703114646680e0b0227036c7919181e0b22623d28393930 flags: 0 RecentlyUsedScenePath-2: - value: 22424703114646680e0b0227036c73150012147b623d28393930 - flags: 0 - RecentlyUsedScenePath-3: value: 22424703114646680e0b0227036c731500121478623d28393930 flags: 0 - RecentlyUsedScenePath-4: + RecentlyUsedScenePath-3: value: 22424703114646680e0b0227036c731500121479623d28393930 flags: 0 - RecentlyUsedScenePath-5: + RecentlyUsedScenePath-4: value: 22424703114646680e0b0227036c6b0502180a232d2468252320092a flags: 0 - RecentlyUsedScenePath-6: - value: 22424703114646680e0b0227036c73150012147e623d28393930 - flags: 0 - RecentlyUsedScenePath-7: + RecentlyUsedScenePath-5: value: 22424703114646680e0b0227036c73150012147f623d28393930 flags: 0 - RecentlyUsedScenePath-8: + RecentlyUsedScenePath-6: value: 22424703114646680e0b0227036c73150012147c623d28393930 flags: 0 + RecentlyUsedScenePath-7: + value: 22424703114646680e0b0227036c73150012147b623d28393930 + flags: 0 + RecentlyUsedScenePath-8: + value: 22424703114646680e0b0227036c73150012147e623d28393930 + flags: 0 UnityRemoteCompression: value: 337f73 flags: 0