You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
akadoc/Assets/scripts/Clock.cs

37 lines
858 B

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Clock : MonoBehaviour {
public GameObject clock;
GameObject day_controller;
DayController daycontroller;
int maxDay;
int maxNight;
// Use this for initialization
void Start() {
day_controller = GameObject.Find("day_controller");
daycontroller = day_controller.GetComponent<DayController> ();
maxDay = daycontroller.maxDay;
maxNight = daycontroller.maxNight;
}
// Update is called once per frame
void Update() {
//TODO: Sync clock with the server
//TODO: Set var as for day % or hour
float fRot = clock.transform.rotation.z;
if(fRot>=0 && fRot>-180) {
clock.transform.Rotate(0, 0, (float)(Time.deltaTime * (-180.0)/maxNight));//2.5min
}
else {
clock.transform.Rotate(0, 0, (float)(Time.deltaTime * (-180.0)/maxDay));//1min
}
}
}