using UnityEngine; public class DayNightCycle : MonoBehaviour { public Light sun; public float dayDuration = 120f; // Длительность дня в секундах private float currentTime = 0f; void Update() { currentTime += Time.deltaTime; float timePercentage = currentTime / dayDuration; float sunAngle = Mathf.Lerp(0, 360, timePercentage); sun.transform.rotation = Quaternion.Euler(new Vector3(sunAngle - 90, 170, 0)); // Сброс времени после полного цикла if (currentTime >= dayDuration) { currentTime = 0f; } } }