unity move character with animation
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
    public CharacterController controller;
    public Animator animator;
    public float speed = 6f;
    // Start is called before the first frame update
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
    }
    // Update is called once per frame
    void Update()
    {
        Vector3 moveForwards = new Vector3(0f, 0f, 1f);
        Vector3 Stop = new Vector3(0f, 0f, 0f);
        if (Input.GetKey(KeyCode.W))
        {
            animator.SetInteger("Condition", 1);
            controller.Move(moveForwards * speed * Time.deltaTime);
        }
        if (Input.GetKeyUp(KeyCode.W))
        {
            animator.SetInteger("Condition", 0);
            controller.Move(Stop);
        }
    }
}