using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TankControls : MonoBehaviour
{
public GameObject Player;
public bool isMoving;
public float horizontal;
public float vertical;
// Update is called once per frame
void Update()
{
if (Input.GetButton("Horizontal") || Input.GetButton("Vertical")) {
GameObject.FindWithTag("Player").GetComponent<Animator>().Play("Walk");
// Player.GetCompent<Animator>().Play("Walk");
isMoving = true;
horizontal = UnityEngine.Input.GetAxisRaw("Horizontal") * Time.deltaTime * 150.0f;
vertical = UnityEngine.Input.GetAxisRaw("Vertical") * Time.deltaTime * 3.9f;
Player.transform.Rotate(0, horizontal, 0);
Player.transform.Rotate(0, 0, -vertical);
//Vector3 direction = new Vector3(horizontal, 0.0f, vertical).normalized;
Vector3 movement = transform.right * horizontal + transform.forward * vertical;
}
else {
isMoving = false;
//database = GameObject.FindWithTag("Player").GetComponent<Animator>().Play("idle");
GameObject.FindWithTag("Player").GetComponent<Animator>().Play("idle");
}
}
}