Files
beyond/Assets/Scripts/Effects/CameraShaker.cs
2024-11-20 15:21:28 +01:00

31 lines
734 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Beyond
{
public class CameraShaker : MonoBehaviour
{
public float m_amplitude = 0.1f;
public float m_time = 1.0f;
Vector3 m_position;
// Start is called before the first frame update
void Start()
{
enabled = false;
}
public void StartShake()
{
enabled = true;
m_position = transform.localPosition;
}
// Update is called once per frame
void LateUpdate()
{
transform.localPosition += new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-1f, 1f));
}
}
}