Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Sun : MonoBehaviour
- {
- private float degreesInSeconds;
- public void OnEnable()
- {
- TimeManager tManager = GameObject.Find("TimeManager").GetComponent<TimeManager>();
- degreesInSeconds = 360.0f / (tManager.gameDayInMinutes * 60.0f);
- //EventManager.SunRotationMethods += RotateSun;
- StartCoroutine(RotateSun());
- }
- public void OnDisable()
- {
- }
- private IEnumerator RotateSun()
- {
- while(true)
- {
- transform.Rotate(new Vector3(degreesInSeconds * Time.deltaTime, 0.0f, 0.0f));
- yield return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement