using UnityEngine;
using System;
using System.Collections;

public class TimeOfDay : MonoBehaviour
{
    DateTime time;
    int prevHour = 0;
    public int hour;

    public enum TIMESTATE { DAY = 0, EVENING, NIGHT }
    public TIMESTATE timeState = 0;

    void Start ()
    {
        timeState = TIMESTATE.NIGHT;

        time = DateTime.Now;
        hour = time.Hour;
        print("System Time: " + time.Hour + ":" + time.Minute);
    }
	

	void Update ()
    {
        time = DateTime.Now;
        hour = time.Hour;

        if (hour != prevHour)
        {
            prevHour = hour;

            if (hour >= 20 || hour < 4)
                timeState = TIMESTATE.NIGHT;
            if ((hour >= 4 && hour < 6) || (hour >= 18 && hour < 20))
                timeState = TIMESTATE.EVENING;
            if (hour >= 6 && hour < 18)
                timeState = TIMESTATE.DAY;
        }
    }
}
