using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotateTank2 : MonoBehaviour
{
public Transform Selftransform;
public int speed = 6;
public bool rotate = true;
// Use this for initialization
void Start()
{
}
void RightRotate()
{
transform.Rotate(0, 0, -3);
}
void LeftRotate()
{
transform.Rotate(0, 0, 3);
}
// Update is called once per frame
void FixedUpdate()
{
if (rotate == true && !Input.GetKey(KeyCode.D))
{
RightRotate();
}
if (rotate == false && !Input.GetKey(KeyCode.D))
{
LeftRotate();
}
if (Input.GetKey(KeyCode.D))
rotate = !rotate;
Selftransform.position += Selftransform.up * speed * Time.deltaTime;
}
else
{
}
}
}