Added Framecap

This commit is contained in:
DominikB 2023-06-25 11:47:17 +02:00
parent 12735a14ee
commit a3cfd71e42
7 changed files with 55 additions and 3 deletions

View File

@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 2410396854066836746} - component: {fileID: 2410396854066836746}
- component: {fileID: 2410396854066836741} - component: {fileID: 2410396854066836741}
- component: {fileID: 2410396854066836740} - component: {fileID: 2410396854066836740}
- component: {fileID: 7151566526002050665}
- component: {fileID: 2410396854066836743} - component: {fileID: 2410396854066836743}
- component: {fileID: 2410396854066836742} - component: {fileID: 2410396854066836742}
- component: {fileID: 2410396854066836737} - component: {fileID: 2410396854066836737}
@ -114,6 +115,19 @@ MonoBehaviour:
gravityScale: 1.5 gravityScale: 1.5
mainCamera: {fileID: 0} mainCamera: {fileID: 0}
grounded: 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 --- !u!70 &2410396854066836743
CapsuleCollider2D: CapsuleCollider2D:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -263,6 +277,7 @@ MonoBehaviour:
landeSound: {fileID: 8300000, guid: 183f7f089c24b164281e8c5053739412, type: 3} landeSound: {fileID: 8300000, guid: 183f7f089c24b164281e8c5053739412, type: 3}
sprungSound: {fileID: 8300000, guid: 3102ff7609304d84d824678029971c73, type: 3} sprungSound: {fileID: 8300000, guid: 3102ff7609304d84d824678029971c73, type: 3}
isJumping: 0 isJumping: 0
counterFall: 0
--- !u!82 &1535821441 --- !u!82 &1535821441
AudioSource: AudioSource:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -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;}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7ac3ef522080e44c08e9a869c54f1e8e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -12,7 +12,7 @@ public class FallingDetection : MonoBehaviour
public AudioClip landeSound; // The sound clip to be played public AudioClip landeSound; // The sound clip to be played
public AudioClip sprungSound; // The sound clip to be played public AudioClip sprungSound; // The sound clip to be played
public bool isJumping = false; public bool isJumping = false;
private int counterFall = 0; public int counterFall = 0;
private void Start() private void Start()
@ -37,11 +37,11 @@ public class FallingDetection : MonoBehaviour
//Wenn nicht auf boden und geschwindigkeits offset neg //Wenn nicht auf boden und geschwindigkeits offset neg
if (!charController.grounded && velocity.y < -0.1f) { if (!charController.grounded && velocity.y < -0.1f) {
//Wenn er bereits fällt, oder der counter erreicht ist zum fallen //Wenn er bereits fällt, oder der counter erreicht ist zum fallen
if (isFalling || counter++>90) { if (isFalling || counter++>20) {
isFalling = true; isFalling = true;
animator.SetBool("IsFalling", true); animator.SetBool("IsFalling", true);
counter = 0; counter = 0;
if(counterFall++>180){ if(counterFall++>35){
wasFallingbefore = true;} wasFallingbefore = true;}
} }
} else { } else {

View File

@ -944,6 +944,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7151566526002050665, guid: 22badd0525f460b4d988841429f6a07e, type: 3}
propertyPath: target
value: 90
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 22badd0525f460b4d988841429f6a07e, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 22badd0525f460b4d988841429f6a07e, type: 3}
--- !u!1 &450159570 --- !u!1 &450159570

View File

@ -342,6 +342,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
respawnPoint: {fileID: 450100290} respawnPoint: {fileID: 450100290}
hurtSound: {fileID: 8300000, guid: 16f3d8f25ca3c494bb6b69278a399379, type: 3}
--- !u!61 &235880309 --- !u!61 &235880309
BoxCollider2D: BoxCollider2D:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -20600,6 +20601,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
respawnPoint: {fileID: 450100290} respawnPoint: {fileID: 450100290}
hurtSound: {fileID: 8300000, guid: 16f3d8f25ca3c494bb6b69278a399379, type: 3}
--- !u!61 &954002763 --- !u!61 &954002763
BoxCollider2D: BoxCollider2D:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -513,6 +513,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
respawnPoint: {fileID: 1175333728} respawnPoint: {fileID: 1175333728}
hurtSound: {fileID: 8300000, guid: 16f3d8f25ca3c494bb6b69278a399379, type: 3}
--- !u!1 &114229337 --- !u!1 &114229337
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -50004,6 +50005,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
respawnPoint: {fileID: 1175333728} respawnPoint: {fileID: 1175333728}
hurtSound: {fileID: 8300000, guid: 16f3d8f25ca3c494bb6b69278a399379, type: 3}
--- !u!4 &1125125478 --- !u!4 &1125125478
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0