Added Framecap in Prefab
This commit is contained in:
3
Assets/AssetsFORELLE/Prefabs/Frank.prefab
generated
3
Assets/AssetsFORELLE/Prefabs/Frank.prefab
generated
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user