using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
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 float Dawn = 125; //FF7D00 125
|
|
public float Noon = 248; //FFF800 248
|
|
|
|
float colorDif;
|
|
Image SunImage;
|
|
|
|
public GameMode mode;
|
|
|
|
void Start()
|
|
{
|
|
SunImage = Sun.gameObject.GetComponent<Image>();
|
|
colorDif = Mathf.Abs(Noon - Dawn);
|
|
}
|
|
|
|
void Update () {
|
|
curTime += 1.0f * Time.deltaTime;
|
|
if (curTime >= MaxTimer)
|
|
{
|
|
mode.PreGameLose();
|
|
}
|
|
|
|
// Color newColor;
|
|
|
|
if (curTime > MaxTimer / 2)
|
|
{
|
|
// newColor = new Color(SunImage.color.r, SunImage.color.g - (colorDif / (1/(0.5 * MaxTimer))), SunImage.color.b);
|
|
}
|
|
else
|
|
{
|
|
// newColor = new Color(SunImage.color.r, SunImage.color.g + (colorDif / (1/(0.5 * MaxTimer))), SunImage.color.b);
|
|
}
|
|
// SunImage.color = newColor;
|
|
Sun.RotateAround(Pivot.transform.position, -1 * Sun.transform.forward, (180 / MaxTimer) * Time.deltaTime);
|
|
|
|
}
|
|
|
|
}
|