Kastell/Assets/Scripts/Casteller.cs
Gerard Gascón f5c1616018 init
2025-02-02 23:45:04 +01:00

19 lines
No EOL
615 B
C#

using System;
using UnityEngine;
using Random = UnityEngine.Random;
public class Casteller : MonoBehaviour {
[SerializeField] private float indexCagat;
[SerializeField] private float shakeAmplitude = .1f;
[SerializeField] private float shakeFrequency = 1f;
[SerializeField] private Transform childPivot;
private void Awake() {
shakeAmplitude = Random.Range(.001f, .01f);
shakeFrequency = Random.Range(1f, 10f);
}
private void Update() {
childPivot.localPosition = new Vector3(Mathf.Cos(Time.time * shakeFrequency) * 2f - 1f, 0, Mathf.Sin(Time.time * shakeFrequency) * 2f - 1f) * shakeAmplitude;
}
}