using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameManager : MonoBehaviour
{
	[Header("With hou manu hours player starts the game")]
	public float startTime = 24f;

	[Header("How many seconds will one default game hour take without modifiers")]
	public int realSecondsInHour = 30;

	[Header("Time in secons for bars to go south")]
	public float defaultFoodConsumeSpeed = 60f;
	public float defaultDrinkConsumeSpeed = 60f;

	[Header("0-1 -> 0=hunger, 1=fully fed")]
	public float foodAffectComfortTreshold = 0.3f;

	[Header("Fireplace")] public LightManager lightManager;

	public List<ComfortZonesConfig> comfortZones; 
	public static GameManager instance;

	public Player player;
	public List<Item> itemRegister;

	[Header("Popups and UI shit")]
	public Canvas canvas;

	public Camera uiCamera;
	public ItemInventoryPanel inventoryPanel;
	public InventorySlot inventorySlot;


	void Awake()
	{
		instance = this;
		GlobalTime.time = startTime;
	}


	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	public float GetModifierAmount(ComfortZone zone)
	{
		foreach (var z in comfortZones)
		{
			if(z.zone == zone)
			{
				float i = z.decreasing ? -1 : 1;
				return z.speedPerecentPerSec * i;
			}
		}

		return 0;
	}
}


[Serializable]
public class ComfortZonesConfig
{
	public ComfortZone zone;
	public bool decreasing = true;
	public float speedPerecentPerSec = 1f;
}
