// Start is called before the first frame update
void Start()
{
As = GetComponent<AudioSource>();
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
playerUpdatePoint = Wv.transform.rotation;
//count += 0.001;
//Debug.Log(count);
if (Wv.transform.rotation.y > 0 && Wv.transform.rotation.y < 180)
{
if (Wv.transform.rotation.y == -playerUpdatePoint.y)
{
GoToBack.SetActive(true);
}
else
{
GoToBack.SetActive(false);
}
}
if (Wv.transform.rotation.y < 0 && Wv.transform.rotation.y > -180)
{
if (-Wv.transform.rotation.y == playerUpdatePoint.y)
{
GoToBack.SetActive(true);
}
else
{
GoToBack.SetActive(false);
}
}
}
private void OnTriggerEnter(Collider collision)
{
if(collision.tag == "BotCar")
{
//OnDeath();
DeathMenu.SetActive(true);
WpPatrol.MovementSpeed = 0f;
As.enabled = false;
rb.constraints= RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezePositionX;
}
}
public void OnDeath()
{
//DeathMenu.SetActive(true);
}
}