SHARE
TWEET

Sun.cs

a guest Aug 6th, 2016 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top