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

public class Anim : MonoBehaviour {

	public Animator animator;

	// Use this for initialization
	void Start () {
		animator = this.GetComponent<Animator> ();
	}

	// Update is called once per frame
	void Update () {
		Control ();
	}

	public void Control (){
		
		if (Input.GetKeyDown (KeyCode.Space)) {
			animator.SetBool ("AtkS", true);
			animator.SetBool ("AtkUD", true);
		}
		if (Input.GetKeyDown (KeyCode.LeftArrow)) {
			animator.SetBool ("WalkS", true);

		}else if (Input.GetKeyUp (KeyCode.LeftArrow)) {
			animator.SetBool ("WalkS", false);
		}

		if (Input.GetKeyDown (KeyCode.RightArrow)) {
			animator.SetBool ("WalkS", true);

		}else if (Input.GetKeyUp (KeyCode.RightArrow)) {
			animator.SetBool ("WalkS", false);
		}

		if (Input.GetKeyDown (KeyCode.UpArrow)) {
			animator.SetBool ("WalkUD", true);
			animator.SetBool ("FaceUD", true);
		}else if (Input.GetKeyUp (KeyCode.UpArrow)) {
			animator.SetBool ("WalkUD", false);
		}

		if (Input.GetKeyDown (KeyCode.DownArrow)) {
			animator.SetBool ("WalkUD", true);
			animator.SetBool ("FaceUD", false);
		}
		else if (Input.GetKeyUp (KeyCode.DownArrow)) {
			animator.SetBool ("WalkUD", false);
		}
	}

	public void StopAtk()
	{
		animator.SetBool ("AtkS", false);
		animator.SetBool ("AtkUD", false);
	}
}