From 9e6b2dd4062a1299aafe9dd3402a1530eceead49 Mon Sep 17 00:00:00 2001 From: Thomas Abot Date: Sun, 8 Mar 2015 15:03:07 +0100 Subject: [PATCH] Fixed day/night cycle --- Assets/scene.unity | 1 + Assets/scripts/Clock.cs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Assets/scene.unity b/Assets/scene.unity index fd82057..770f9bd 100644 --- a/Assets/scene.unity +++ b/Assets/scene.unity @@ -21168,6 +21168,7 @@ MonoBehaviour: m_EditorClassIdentifier: targetPos: {x: 0, y: 0, z: 0} targetRot: {x: 0, y: 0, z: 0, w: 0} + initLocation: {fileID: 717116040} --- !u!81 &1859570686 AudioListener: m_ObjectHideFlags: 0 diff --git a/Assets/scripts/Clock.cs b/Assets/scripts/Clock.cs index 26db32b..4225962 100644 --- a/Assets/scripts/Clock.cs +++ b/Assets/scripts/Clock.cs @@ -25,9 +25,9 @@ public class Clock : MonoBehaviour { //TODO: Sync clock with the server //TODO: Set var as for day % or hour - float fRot = clock.transform.rotation.z; + float fRot = clock.transform.rotation.eulerAngles.z; - if(fRot>=0 && fRot>-180) { + if(fRot>=180) { clock.transform.Rotate(0, 0, (float)(Time.deltaTime * (-180.0)/maxNight));//2.5min } else {