Add scene transitions, lose sanity points
This commit is contained in:
@@ -4,27 +4,16 @@ namespace Scampz.GameJam
|
||||
{
|
||||
public class CameraFollow : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private Transform targetObject;
|
||||
[SerializeField]
|
||||
private Vector3 cameraOffset;
|
||||
[SerializeField]
|
||||
private float smoothFactor = 0.5f;
|
||||
[SerializeField]
|
||||
private bool lookAtTarget = false;
|
||||
[SerializeField]
|
||||
private float _cameraYPosition = 45f;
|
||||
|
||||
private void Start()
|
||||
private void FixedUpdate()
|
||||
{
|
||||
transform.position = targetObject.transform.position - cameraOffset;
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
var lockedInYPosition = new Vector3(targetObject.transform.position.x - cameraOffset.x, _cameraYPosition, targetObject.transform.position.z - cameraOffset.z);
|
||||
var player = GameObject.FindGameObjectWithTag("Player");
|
||||
var lockedInYPosition = new Vector3(player.transform.position.x - cameraOffset.x, _cameraYPosition, player.transform.position.z - cameraOffset.z);
|
||||
transform.position = lockedInYPosition;
|
||||
transform.LookAt(transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user