// Use this for initialization void Start() { sunUpdateTimer = new System.Timers.Timer(1000); sunUpdateTimer.Elapsed += new ElapsedEventHandler(this.onSunUpdate); //sunUpdateTimer.Interval = 10000; sunUpdateTimer.Enabled = true; playerLocation = new Vector3(0.0f, 0.0f, 0.0f); //playerLocation.x = ApplicationManager.Instance.getGeolocationManager ().getGeolocation ().x; //playerLocation.y = ApplicationManager.Instance.getGeolocationManager ().getGeolocation ().y; sunLocation = SunDirection.CalculateSunPosition(DateTime.Now, playerLocation.x, playerLocation.y); }
private void onSunUpdate(object source, ElapsedEventArgs e) { sunUpdateTimer.Interval = 2000; sunLocation = SunDirection.CalculateSunPosition(DateTime.Now, playerLocation.x, playerLocation.y); }