Add camera lower bound
This commit is contained in:
@@ -9,6 +9,7 @@ public class PlayerCameraMovement : MonoBehaviour
|
||||
public float weight;
|
||||
public float speed;
|
||||
private GameObject playerThatWon;
|
||||
public float lowerBound;
|
||||
|
||||
public bool winScene = false;
|
||||
|
||||
@@ -53,6 +54,7 @@ public class PlayerCameraMovement : MonoBehaviour
|
||||
|
||||
target = start * weight + playerAverage * (1 - weight);
|
||||
transform.position = Vector3.Lerp(transform.position, new Vector3(target.x, target.y, transform.position.z), speed * Time.deltaTime);
|
||||
transform.position = new Vector3(Mathf.Clamp(transform.position.x, lowerBound, Mathf.Infinity), transform.position.y, transform.position.z);
|
||||
}
|
||||
|
||||
public void WinScene(GameObject player)
|
||||
|
||||
@@ -71,7 +71,7 @@ public class PlayerMovement : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (GameManager.Instance.gameOver) maxSpeed = 0.1f;
|
||||
if (GameManager.Instance.gameOver) maxSpeed = 1f;
|
||||
if (damageable.dying/* || (GameManager.Instance != null && GameManager.Instance.gameOver)*/) return;
|
||||
|
||||
Jump();
|
||||
@@ -99,7 +99,7 @@ public class PlayerMovement : MonoBehaviour
|
||||
animationPlayer.SetState(AnimationPlayer.AnimationState.Jump);
|
||||
else
|
||||
{
|
||||
if (Mathf.Abs(body.linearVelocityX) >= 0.5f)
|
||||
if (Mathf.Abs(body.linearVelocityX) >= 0.05f)
|
||||
animationPlayer.SetState(GameManager.Instance.gameOver ? AnimationPlayer.AnimationState.Walk : AnimationPlayer.AnimationState.Run);
|
||||
else
|
||||
animationPlayer.SetState(AnimationPlayer.AnimationState.Idle);
|
||||
|
||||
Reference in New Issue
Block a user