Fps Animation Help

I have a fps moving script but i don’t know how to add my walk animation to it, the last moving script i used, it didn’t work(it said the animation could not be found) even when i set it to legacy, is there any way to add animation code to this? Please help and btw here’s my move code

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour
	public bool controllable = false;

	public float speed = 7.0f;
	public float jumpSpeed = 6.0f;
	public float gravity = 20.0f;

	private Vector3 moveDirection = Vector3.zero;
	private CharacterController controller;

	// Use this for initialization
	void Start()
		controller = GetComponent<CharacterController>();

	// Update is called once per frame
	void Update()
		if (controller.isGrounded && controllable)
			moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
			moveDirection = transform.TransformDirection(moveDirection);
			moveDirection *= speed;

			if (Input.GetButton("Jump"))
				moveDirection.y = jumpSpeed;

		moveDirection.y -= gravity * Time.deltaTime;
		controller.Move(moveDirection * Time.deltaTime);

You can write function which will trigger the animation from animator. Lets say you have boolean named “isWalking” in your animator state machine and when “isWalking == true” a transition is occurs to walk state. Following function will do the job for you. Call this function when you want the animation to start. Make sure that you mark the animation in inspector as loop so it wont stop after running once.

void PlayWalkAnimation()
      Animator animator = getComponent<Animator>();
      //also set variable in animator according to your conditions to make transition to "Walk" state
      animator.SetBool("isWalking" , true);