Added Framecap in Prefab

This commit is contained in:
DominikB 2023-06-25 12:04:22 +02:00
parent a3cfd71e42
commit d6b648ead0
4 changed files with 30 additions and 11 deletions

View File

@ -127,7 +127,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7ac3ef522080e44c08e9a869c54f1e8e, type: 3}
m_Name:
m_EditorClassIdentifier:
target: 60
target: 90
--- !u!70 &2410396854066836743
CapsuleCollider2D:
m_ObjectHideFlags: 0
@ -278,6 +278,7 @@ MonoBehaviour:
sprungSound: {fileID: 8300000, guid: 3102ff7609304d84d824678029971c73, type: 3}
isJumping: 0
counterFall: 0
didLandDuringJump: 0
--- !u!82 &1535821441
AudioSource:
m_ObjectHideFlags: 0

View File

@ -13,6 +13,7 @@ public class FallingDetection : MonoBehaviour
public AudioClip sprungSound; // The sound clip to be played
public bool isJumping = false;
public int counterFall = 0;
public bool didLandDuringJump = false;
private void Start()
@ -28,7 +29,9 @@ public class FallingDetection : MonoBehaviour
Vector3 velocity = playerRigidbody.velocity;
//Wenn nicht auf boden und geschwindigkeits offset pos
if (!charController.grounded && velocity.y > 0.1f && !isJumping){
audioSource.PlayOneShot(sprungSound);
didLandDuringJump = charController.grounded;
if(!didLandDuringJump){
audioSource.PlayOneShot(sprungSound);}
isJumping = true;
}
if(charController.grounded){
@ -41,6 +44,7 @@ public class FallingDetection : MonoBehaviour
isFalling = true;
animator.SetBool("IsFalling", true);
counter = 0;
if(counterFall++>35){
wasFallingbefore = true;}
}
@ -49,10 +53,14 @@ public class FallingDetection : MonoBehaviour
counter = 0;
counterFall=0;
animator.SetBool("IsFalling", false);
didLandDuringJump = false;
if(wasFallingbefore){
wasFallingbefore = false;
audioSource.PlayOneShot(landeSound);
}
}
if (charController.grounded && (Mathf.Abs(velocity.y)<0.01f)){
didLandDuringJump = false;
}
}
}

View File

@ -944,10 +944,6 @@ 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

View File

@ -2059,6 +2059,8 @@ Tilemap:
m_Data: {fileID: 11400000, guid: 4e08e3ee69d290c4cabf906eeace16de, type: 2}
- m_RefCount: 14
m_Data: {fileID: 11400000, guid: 1230c5c14ee4beb49ae16ac90b5cb1ec, type: 2}
- m_RefCount: 0
m_Data: {fileID: 0}
m_TileSpriteArray:
- m_RefCount: 21
m_Data: {fileID: 1966963234, guid: eff64c0333047784e9230d6b5fbbcf1b, type: 3}
@ -2072,6 +2074,8 @@ Tilemap:
m_Data: {fileID: 1363573075, guid: eff64c0333047784e9230d6b5fbbcf1b, type: 3}
- m_RefCount: 14
m_Data: {fileID: -877665526, guid: eff64c0333047784e9230d6b5fbbcf1b, type: 3}
- m_RefCount: 0
m_Data: {fileID: 0}
m_TileMatrixArray:
- m_RefCount: 149
m_Data:
@ -2098,7 +2102,7 @@ Tilemap:
m_AnimationFrameRate: 1
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Origin: {x: 0, y: -6, z: 0}
m_Size: {x: 72, y: 21, z: 1}
m_Size: {x: 85, y: 21, z: 1}
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
m_TileOrientation: 0
m_TileOrientationMatrix:
@ -12762,6 +12766,16 @@ Tilemap:
m_TileObjectToInstantiateIndex: 65535
dummyAlignment: 0
m_AllTileFlags: 1073741825
- first: {x: 84, y: 0, z: 0}
second:
serializedVersion: 2
m_TileIndex: 2
m_TileSpriteIndex: 2
m_TileMatrixIndex: 0
m_TileColorIndex: 0
m_TileObjectToInstantiateIndex: 65535
dummyAlignment: 0
m_AllTileFlags: 1073741825
- first: {x: 85, y: 0, z: 0}
second:
serializedVersion: 2
@ -19938,7 +19952,7 @@ Tilemap:
m_Data: {fileID: 11400000, guid: 8d4b8973dba9a474c80fa2d34638d3a5, type: 2}
- m_RefCount: 118
m_Data: {fileID: 11400000, guid: dbc2272ac330651448f6eef2843017dc, type: 2}
- m_RefCount: 17
- m_RefCount: 18
m_Data: {fileID: 11400000, guid: a7a4ab48b2162244990d859de77132a4, type: 2}
- m_RefCount: 0
m_Data: {fileID: 0}
@ -19959,7 +19973,7 @@ Tilemap:
m_Data: {fileID: 529542140, guid: eff64c0333047784e9230d6b5fbbcf1b, type: 3}
- m_RefCount: 118
m_Data: {fileID: -840379371, guid: eff64c0333047784e9230d6b5fbbcf1b, type: 3}
- m_RefCount: 17
- m_RefCount: 18
m_Data: {fileID: 21300000, guid: acad783af9b784d4da63b4763e69af8f, type: 3}
- m_RefCount: 0
m_Data: {fileID: 0}
@ -19976,7 +19990,7 @@ Tilemap:
- m_RefCount: 9
m_Data: {fileID: 145424651, guid: eff64c0333047784e9230d6b5fbbcf1b, type: 3}
m_TileMatrixArray:
- m_RefCount: 1702
- m_RefCount: 1703
m_Data:
e00: 1
e01: 0
@ -19995,7 +20009,7 @@ Tilemap:
e32: 0
e33: 1
m_TileColorArray:
- m_RefCount: 1702
- m_RefCount: 1703
m_Data: {r: 1, g: 1, b: 1, a: 1}
m_TileObjectToInstantiateArray: []
m_AnimationFrameRate: 1