|
|
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
-
- public class Timer : MonoBehaviour {
-
- //Time stuff
- public float MaxTimer = 120.0f;
- float curTime = 0.0f;
- public Transform Pivot;
- public Transform Sun;
- float curRot = 0;
-
- public Color Dawn;
- public Color Noon;
-
- void Start()
- {
- Sun.gameObject.GetComponent<Image>().Color = Dawn;
- }
-
- void Update () {
- curTime += 1.0f * Time.deltaTime;
- if (curTime >= MaxTimer)
- {
- //Game Lose code here
- }
-
- /*
- //Move the sun
- float reqRot = (curTime / MaxTimer) * 180;
- if (reqRot > 180)
- {
- reqRot = 180;
- }
- if (reqRot > curRot)
- {
- float rotDistance = reqRot - curRot;
- // Sun.RotateAround(Pivot.transform.position, Sun.transform.forward, rotDistance);
- curRot = reqRot;
- }
- */
- Sun.RotateAround(Pivot.transform.position, -1 * Sun.transform.forward, (180 / MaxTimer) * Time.deltaTime);
-
- }
-
- }
|