29 lines
616 B
C#
29 lines
616 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class CameraShakeRequester : MonoBehaviour
|
|
{
|
|
[SerializeField] private bool shakeOnSpawn;
|
|
[SerializeField] private float duration = 0.2f;
|
|
[SerializeField] private float magnitude = 0.05f;
|
|
|
|
CameraFollow cameraFollow;
|
|
|
|
private void Awake()
|
|
{
|
|
cameraFollow = Camera.main.GetComponent<CameraFollow>();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
if (shakeOnSpawn)
|
|
RequestScreenShake();
|
|
}
|
|
|
|
public void RequestScreenShake()
|
|
{
|
|
cameraFollow.Shake(0.2f, magnitude);
|
|
}
|
|
}
|