init
This commit is contained in:
28
Assets/Scripts/CameraFollower.cs
Normal file
28
Assets/Scripts/CameraFollower.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraFollower : MonoBehaviour
|
||||
{
|
||||
public static CameraFollower instance;
|
||||
void Awake(){
|
||||
instance = this;
|
||||
}
|
||||
public float Xsmoothness =1f;
|
||||
public float Ysmoothness =1f;
|
||||
public static Transform Target;
|
||||
void Update()
|
||||
{
|
||||
}
|
||||
|
||||
public static void UpdateFrame(){
|
||||
instance.updateFrame();
|
||||
}
|
||||
|
||||
|
||||
void updateFrame(){
|
||||
float newX = Mathf.Lerp(transform.position.x, Target.position.x, Xsmoothness);
|
||||
float newY = Mathf.Lerp(transform.position.y, Target.position.y, Ysmoothness);
|
||||
transform.position = new Vector3(newX, newY, transform.position.z);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user