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

namespace HutongGames.PlayMaker.Actions
{
	[ActionCategory("ENVIRO")]
	[Tooltip("Changes the current weather by name.")]
	public class SetWeatherByName : FsmStateAction
	{
		[RequiredField]
		public FsmString WeatherName;

		[Tooltip("Repeat every frame.")]
		public bool everyFrame;

		public override void OnEnter()
		{
			if(EnviroManager.instance.Weather != null)
            EnviroManager.instance.Weather.ChangeWeather(WeatherName.Value);

			if (!everyFrame)
			{
				Finish();
			}
		}

		public override void OnUpdate()
		{
			if(EnviroManager.instance.Weather != null)
            EnviroManager.instance.Weather.ChangeWeather(WeatherName.Value);
		}
		
	}


}