float horizontalInput;
float verticalInput;
float skor;
public float vSpeed = 4f;
public float hSpeed = 2f;
public float rLimit = 178;
public TextMeshProUGUI aText;
void Start()
{
}
void Update()
{
Move();
}
void Move()
{
horizontalInput = Input.GetAxis("Horizontal");
verticalInput = Input.GetAxis("Vertical");
transform.Translate(new Vector3(horizontalInput*hSpeed,0,verticalInput*vSpeed)*Time.deltaTime);
transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(new Vector3(0, horizontalInput * rLimit, 0)), 2f*Time.deltaTime);
}
private void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "Enemy")
{
skor += 10;
Debug.Log(skor);
aText.text = "Puan: " + skor;
vSpeed++;
float valueX = Random.Range(-16f, 16f);
float valueZ = Random.Range(-16f, 16f);
other.transform.position = new Vector3(valueX,0,valueZ);
}
}