Advertisement
Guest User

Sun.cs

a guest
Aug 6th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Sun : MonoBehaviour
  5. {
  6.     private float degreesInSeconds;
  7.  
  8.     public void OnEnable()
  9.     {
  10.         TimeManager tManager = GameObject.Find("TimeManager").GetComponent<TimeManager>();
  11.         degreesInSeconds = 360.0f / (tManager.gameDayInMinutes * 60.0f);
  12.  
  13.         //EventManager.SunRotationMethods += RotateSun;
  14.         StartCoroutine(RotateSun());
  15.     }
  16.  
  17.     public void OnDisable()
  18.     {
  19.        
  20.     }
  21.  
  22.     private IEnumerator RotateSun()
  23.     {
  24.         while(true)
  25.         {
  26.             transform.Rotate(new Vector3(degreesInSeconds * Time.deltaTime, 0.0f, 0.0f));
  27.             yield return null;
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement