From a3cfd71e4271e093500f9e16322103e621cb94f9 Mon Sep 17 00:00:00 2001 From: DominikB Date: Sun, 25 Jun 2023 11:47:17 +0200 Subject: [PATCH] Added Framecap --- Assets/AssetsFORELLE/Prefabs/Frank.prefab | 15 +++++++++++++++ Assets/AssetsFORELLE/Script/FPSTarget.cs | 18 ++++++++++++++++++ Assets/AssetsFORELLE/Script/FPSTarget.cs.meta | 11 +++++++++++ .../AssetsFORELLE/Script/FallingDetection.cs | 6 +++--- .../ScenesInGame/2PlatzhalterTutorial.unity | 4 ++++ .../ScenesInGame/5.0TutorialDimShift.unity | 2 ++ .../ScenesInGame/5.2.TutorialDimShift.unity | 2 ++ 7 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 Assets/AssetsFORELLE/Script/FPSTarget.cs create mode 100644 Assets/AssetsFORELLE/Script/FPSTarget.cs.meta diff --git a/Assets/AssetsFORELLE/Prefabs/Frank.prefab b/Assets/AssetsFORELLE/Prefabs/Frank.prefab index 86a0a13..55d149a 100644 --- a/Assets/AssetsFORELLE/Prefabs/Frank.prefab +++ b/Assets/AssetsFORELLE/Prefabs/Frank.prefab @@ -11,6 +11,7 @@ GameObject: - component: {fileID: 2410396854066836746} - component: {fileID: 2410396854066836741} - component: {fileID: 2410396854066836740} + - component: {fileID: 7151566526002050665} - component: {fileID: 2410396854066836743} - component: {fileID: 2410396854066836742} - component: {fileID: 2410396854066836737} @@ -114,6 +115,19 @@ MonoBehaviour: gravityScale: 1.5 mainCamera: {fileID: 0} grounded: 0 +--- !u!114 &7151566526002050665 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2410396854066836738} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7ac3ef522080e44c08e9a869c54f1e8e, type: 3} + m_Name: + m_EditorClassIdentifier: + target: 60 --- !u!70 &2410396854066836743 CapsuleCollider2D: m_ObjectHideFlags: 0 @@ -263,6 +277,7 @@ MonoBehaviour: landeSound: {fileID: 8300000, guid: 183f7f089c24b164281e8c5053739412, type: 3} sprungSound: {fileID: 8300000, guid: 3102ff7609304d84d824678029971c73, type: 3} isJumping: 0 + counterFall: 0 --- !u!82 &1535821441 AudioSource: m_ObjectHideFlags: 0 diff --git a/Assets/AssetsFORELLE/Script/FPSTarget.cs b/Assets/AssetsFORELLE/Script/FPSTarget.cs new file mode 100644 index 0000000..831805c --- /dev/null +++ b/Assets/AssetsFORELLE/Script/FPSTarget.cs @@ -0,0 +1,18 @@ +using UnityEngine; +public class FPSTarget : MonoBehaviour + { + + public int target = 30; + + void Awake() + { + QualitySettings.vSyncCount = 0; + Application.targetFrameRate = target; + } + + void Update() + { + if(Application.targetFrameRate != target){ + Application.targetFrameRate = target;} + } + } \ No newline at end of file diff --git a/Assets/AssetsFORELLE/Script/FPSTarget.cs.meta b/Assets/AssetsFORELLE/Script/FPSTarget.cs.meta new file mode 100644 index 0000000..2e5eb3e --- /dev/null +++ b/Assets/AssetsFORELLE/Script/FPSTarget.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7ac3ef522080e44c08e9a869c54f1e8e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AssetsFORELLE/Script/FallingDetection.cs b/Assets/AssetsFORELLE/Script/FallingDetection.cs index ecc75f4..2722f09 100644 --- a/Assets/AssetsFORELLE/Script/FallingDetection.cs +++ b/Assets/AssetsFORELLE/Script/FallingDetection.cs @@ -12,7 +12,7 @@ public class FallingDetection : MonoBehaviour public AudioClip landeSound; // The sound clip to be played public AudioClip sprungSound; // The sound clip to be played public bool isJumping = false; - private int counterFall = 0; + public int counterFall = 0; private void Start() @@ -37,11 +37,11 @@ public class FallingDetection : MonoBehaviour //Wenn nicht auf boden und geschwindigkeits offset neg if (!charController.grounded && velocity.y < -0.1f) { //Wenn er bereits fällt, oder der counter erreicht ist zum fallen - if (isFalling || counter++>90) { + if (isFalling || counter++>20) { isFalling = true; animator.SetBool("IsFalling", true); counter = 0; - if(counterFall++>180){ + if(counterFall++>35){ wasFallingbefore = true;} } } else { diff --git a/Assets/Scenes/ScenesInGame/2PlatzhalterTutorial.unity b/Assets/Scenes/ScenesInGame/2PlatzhalterTutorial.unity index bb651b1..95ec2b5 100644 --- a/Assets/Scenes/ScenesInGame/2PlatzhalterTutorial.unity +++ b/Assets/Scenes/ScenesInGame/2PlatzhalterTutorial.unity @@ -944,6 +944,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 7151566526002050665, guid: 22badd0525f460b4d988841429f6a07e, type: 3} + propertyPath: target + value: 90 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 22badd0525f460b4d988841429f6a07e, type: 3} --- !u!1 &450159570 diff --git a/Assets/Scenes/ScenesInGame/5.0TutorialDimShift.unity b/Assets/Scenes/ScenesInGame/5.0TutorialDimShift.unity index 2cef1be..aff4b96 100644 --- a/Assets/Scenes/ScenesInGame/5.0TutorialDimShift.unity +++ b/Assets/Scenes/ScenesInGame/5.0TutorialDimShift.unity @@ -342,6 +342,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: respawnPoint: {fileID: 450100290} + hurtSound: {fileID: 8300000, guid: 16f3d8f25ca3c494bb6b69278a399379, type: 3} --- !u!61 &235880309 BoxCollider2D: m_ObjectHideFlags: 0 @@ -20600,6 +20601,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: respawnPoint: {fileID: 450100290} + hurtSound: {fileID: 8300000, guid: 16f3d8f25ca3c494bb6b69278a399379, type: 3} --- !u!61 &954002763 BoxCollider2D: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/ScenesInGame/5.2.TutorialDimShift.unity b/Assets/Scenes/ScenesInGame/5.2.TutorialDimShift.unity index 0151078..2c49378 100644 --- a/Assets/Scenes/ScenesInGame/5.2.TutorialDimShift.unity +++ b/Assets/Scenes/ScenesInGame/5.2.TutorialDimShift.unity @@ -513,6 +513,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: respawnPoint: {fileID: 1175333728} + hurtSound: {fileID: 8300000, guid: 16f3d8f25ca3c494bb6b69278a399379, type: 3} --- !u!1 &114229337 GameObject: m_ObjectHideFlags: 0 @@ -50004,6 +50005,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: respawnPoint: {fileID: 1175333728} + hurtSound: {fileID: 8300000, guid: 16f3d8f25ca3c494bb6b69278a399379, type: 3} --- !u!4 &1125125478 Transform: m_ObjectHideFlags: 0