Disable movement button, C#

Hi.

I need to disable just movement backward. I mean when I press “down” character must do nothing.
I have no idea what I need to do.

There is my script:

using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {

private Animator anim;
private CharacterController controller;
public float speed = 6.0f;
public float turnSpeed = 0.0f;
private Vector3 moveDirection = Vector3.zero;
public float gravity = 20.0f;

// Use this for initialization
void Start () {
	anim = gameObject.GetComponentInChildren<Animator> ();
	controller = GetComponent<CharacterController> ();
}

// Update is called once per frame
void Update () {

	if (Input.GetKey ("up")) {
		anim.SetInteger ("AnimPar", 1);
	} else {
		anim.SetInteger ("AnimPar", 0);
	}
	{
		if (Input.GetKey ("down")) {
			\\ here probably a solution
	}

	if (controller.isGrounded) {
		moveDirection = transform.forward * Input.GetAxis("Vertical") * speed;
	}

	float turn = Input.GetAxis ("Horizontal");
	transform.Rotate (0, turn * turnSpeed * Time.deltaTime, 0);
	controller.Move (moveDirection * Time.deltaTime);
	moveDirection.y -= gravity * Time.deltaTime;
}

}

The easiest solution would be to do this

  1. Go to “Edit\Project Settings\Input” from the main menu
  2. Select the Axes drop down in the inspector
  3. Clear the “Negative Button” and “Alt Negative Button” values (defaults are down and s)

Now Unity will ignore both buttons.