/*
 * BOS done by Bug Games Team - www.Bug-Games.net - @BugGames - info@bug-games.net
 * BOS game was an entry for Global Game Jam 2015 www.GlobalGameJam.com
 * Programmer: Danar Kayfi - @DanarKayfi
 * Artiest: Mohammad Al-Dmour - @LightOfDarkness
 * Everything (Code+Art) in this game belongs to Bug Games Team.
 * Some SFX are from soundbible.com.
 */
using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class enterGameCMD : MonoBehaviour 
{
	public GameObject gameBodyText;
	public GameObject newGameCMD;
	public InputField gameInputField;

	public AudioClip beep;
	public AudioClip fuzzyBeep;

	// Use this for initialization
	void Start () 
	{
		gameInputField.Select();
		gameInputField.ActivateInputField();
	}
	
	// Update is called once per frame
	void Update () 
	{
		
	}

	public void endGameInput()
	{


		switch (newGameCMD.GetComponent<Text> ().text.ToLower())
		{
		case "move":
			audio.clip = beep;
			player_script.move = true;
			player_script.turn = false;
			gameBodyText.GetComponent<Text> ().text = "Moving";
			break;
		case "turn":
			audio.clip = beep;
			player_script.move = false;
			player_script.turn = true;
			gameBodyText.GetComponent<Text> ().text = "turning";
			break;
		case "stop":
			audio.clip = beep;
			player_script.move = false;
			player_script.turn = false;
			gameBodyText.GetComponent<Text> ().text = "Waiting for command";
			break;
		case "help":
			audio.clip = beep;
			player_script.move = false;
			player_script.turn = false;
			gameBodyText.GetComponent<Text> ().text = "Move turn stop exit";
			break;
		case "exit":
			audio.clip = beep;
			player_script.move = false;
			player_script.turn = false;
			gameBodyText.GetComponent<Text> ().text = "Exiting";
			Application.LoadLevel("Scene_main");
			break;
		default:
			audio.clip = fuzzyBeep;
			newGameCMD.GetComponent<Text> ().text = "";
			gameBodyText.GetComponent<Text> ().text = " ";
			break;
		}
		gameInputField.GetComponent<InputField> ().text = "";

		audio.Play();

		gameInputField.Select();
		gameInputField.ActivateInputField();
	}
}
