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

@@ -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 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 {