asset integration 50%

This commit is contained in:
2026-03-29 02:27:55 +05:30
parent 3108262326
commit b8ce9120d5
1691 changed files with 1192616 additions and 262 deletions
+48
View File
@@ -0,0 +1,48 @@
using UnityEngine;
using DG.Tweening;
[RequireComponent(typeof(Camera))]
public class CameraEffects : MonoBehaviour
{
public static CameraEffects instance;
Camera cam;
[SerializeField]private float stretchFactor = 0;
[SerializeField]private bool isBeingStretched = false;
[SerializeField]private float minFov = 5;
[SerializeField]private float maxFov = 10;
[SerializeField]private float fovSpeed = 10;
[SerializeField] private float bounceDuration = 0.35f;
[SerializeField] private float bounceElasticity = 0.7f;
[SerializeField] private float bounceOvershoot = 0.2f;
void Awake()
{
instance = this;
cam = Camera.main;
}
void Update()
{
if(isBeingStretched){
float targetFov = minFov + stretchFactor * (maxFov - minFov);
cam.orthographicSize = Mathf.Lerp(cam.orthographicSize, targetFov, Time.deltaTime * fovSpeed);
}
}
public void SetStretchFactor(float stretchFactor){
this.stretchFactor = stretchFactor;
isBeingStretched = true;
}
public void ReleaseStretchFactor(){
stretchFactor = 0;
isBeingStretched = false;
cam.DOOrthoSize(minFov, bounceDuration)
.SetEase(Ease.OutElastic, bounceElasticity, bounceOvershoot)
.OnComplete(() => {
stretchFactor = 0;
});
}
}