Revision 125:2f0ae0194ff2 Assets/Time of Day/Assets/Scripts/TOD_Time.cs
b/Assets/Time of Day/Assets/Scripts/TOD_Time.cs | ||
---|---|---|
216 | 216 |
sky.Cycle.Day = DateTime.Now.Day; |
217 | 217 |
} |
218 | 218 |
|
219 |
// ------> added to TOD plugin |
|
219 | 220 |
if (UseBostonTime) |
220 | 221 |
{ |
221 |
sky.Cycle.Hour = (float)DateTime.Now.TimeOfDay.TotalHours; |
|
222 |
int month = (int)DateTime.Now.Month; |
|
223 |
if(month>=3 && month <=11){ |
|
224 |
sky.Cycle.Hour = (float)DateTime.UtcNow.TimeOfDay.TotalHours - 4; |
|
225 |
Debug.Log ("The time in Boston is now " + sky.Cycle.Hour + " hours (daylight savings)."); |
|
226 |
} |
|
227 |
else{ |
|
228 |
sky.Cycle.Hour = (float)DateTime.UtcNow.TimeOfDay.TotalHours - 5; |
|
229 |
Debug.Log ("The time in Boston is now " + sky.Cycle.Hour + " hours."); |
|
230 |
} |
|
222 |
sky.Cycle.Hour = bostonTime(); |
|
231 | 223 |
} |
232 |
|
|
224 |
// <------ added to TOD plugin |
|
233 | 225 |
|
234 | 226 |
if (UseDeviceTime) |
235 | 227 |
{ |
... | ... | |
240 | 232 |
RefreshTimeCurve(); |
241 | 233 |
} |
242 | 234 |
|
235 |
// ------> added to TOD plugin |
|
236 |
public float bostonTime() |
|
237 |
{ |
|
238 |
float bostonTime;// = 12f; |
|
239 |
int month = (int)DateTime.Now.Month; |
|
240 |
if(month>=3 && month <=11){ |
|
241 |
bostonTime = (float)DateTime.UtcNow.TimeOfDay.TotalHours - 4f; |
|
242 |
Debug.Log ("The time in Boston is now " + bostonTime + " hours (daylight savings)."); |
|
243 |
} |
|
244 |
else{ |
|
245 |
bostonTime = (float)DateTime.UtcNow.TimeOfDay.TotalHours - 5f; |
|
246 |
Debug.Log ("The time in Boston is now " + bostonTime + " hours."); |
|
247 |
} |
|
248 |
return bostonTime; |
|
249 |
} |
|
250 |
|
|
251 |
public float getTime() |
|
252 |
{ |
|
253 |
return sky.Cycle.Hour; |
|
254 |
} |
|
255 |
// <------ added to TOD plugin |
|
256 |
|
|
257 |
|
|
243 | 258 |
protected void FixedUpdate() |
244 | 259 |
{ |
245 | 260 |
if (ProgressTime && DayLengthInMinutes > 0) |
Also available in: Unified diff