using UnityEngine;
using System.Collections;

public class CursorManager : MonoBehaviour {

	public Texture2D normalCursor;
	public Texture2D handCursor;
	public Texture2D bladeCursor;

	// Use this for initialization
	void Start () {
		Cursor.SetCursor(normalCursor, Vector2.zero, CursorMode.Auto);
	}
	
	// Update is called once per frame
	void Update () {
		if(GameManager.instance.currentState == GameManager.GameState.InRitual){
			//Physics2D.Raycast(new Vector2(camera.main.ScreenToWorldPoint(Input.mousePosition).x,camera.ScreenToWorldPoint(Input.mousePosition).y), Vector2.Zero, 0f);
			RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
			if(hit && hit.collider.gameObject.CompareTag("Adept")){
				Cursor.SetCursor(handCursor, Vector2.zero, CursorMode.Auto);
			}
			else{
				Cursor.SetCursor(normalCursor, Vector2.zero, CursorMode.Auto);
			}
		}
		else if(GameManager.instance.currentState == GameManager.GameState.InRitual_Sacrifice){
			//Physics2D.Raycast(new Vector2(camera.main.ScreenToWorldPoint(Input.mousePosition).x,camera.ScreenToWorldPoint(Input.mousePosition).y), Vector2.Zero, 0f);
			RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
			if(hit && hit.collider.gameObject.CompareTag("Adept")){
				Cursor.SetCursor(bladeCursor, Vector2.zero, CursorMode.Auto);
			}
			else{
				Cursor.SetCursor(normalCursor, Vector2.zero, CursorMode.Auto);
			}
		}
		else{
			Cursor.SetCursor(normalCursor, Vector2.zero, CursorMode.Auto);
		}
	}
}
