using UnityEngine; public class LanternSwing : MonoBehaviour { [Header("Swing Settings")] public float swingAngle = 15f; // Sallanma açısı public float swingSpeed = 2f; // Sallanma hızı public float randomOffsetRange = Mathf.PI * 2f; // Rastgele ofset aralığı private Quaternion initialRotation; private float randomOffset; void Start() { // Başlangıç rotasyonunu kaydedin initialRotation = transform.rotation; // Her bir lantern için rastgele bir offset oluşturun randomOffset = Random.Range(0f, randomOffsetRange); } void Update() { // Sallanma hareketi (sinüs dalgası) - rastgele offset ile float swingOffset = Mathf.Sin(Time.time * swingSpeed + randomOffset) * swingAngle; transform.rotation = initialRotation * Quaternion.Euler(0, 0, swingOffset); } }