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

public class GameManager : MonoSingleton <GameManager> {

	#region Private Variables
	[SerializeField]
	private List <PolarityFavor> _polarities;

	[SerializeField]
	private PlayerControl _player;

	[SerializeField]
	private WorldControl _world;

	private static bool _canMove = true;
	#endregion


	#region Getters and Setters
	public List <PolarityFavor> polarities {
		get {
			return _polarities;
		}
		private set {
			_polarities = value;
		}
	}

	public static bool canMove {
		get {
			return _canMove;
		}
		set {
			_canMove = value;
		}
	}
	#endregion


	#region Events
	protected override void AwakeEx () {



	}

	void Update () {

		if (canMove)
			Trudge (Input.anyKey ? 1f : 0f);
		else
			_player.Animate (false);
		
	}
	#endregion


	#region Methods
	void Reset () {

		foreach (PolarityFavor pf in polarities)
			pf.Reset (this);
		
	}


	void Trudge (float h) {

		_world.Move (h);
		_player.Animate (h != 0f);
		
	} 
	#endregion

}
