Hi, I have a problem. The ball is on a path and to keep continue rolling it have to pass through the obstacle, the only way to do that is changing the color which has to be ste same of the obstacle. if the color is different the ball don’t pass, so is game over. The problem is that the game over part doesn’t work, any idea?
Thank you ![]()
using UnityEngine;
public class Movement : MonoBehaviour
{
[SerializeField]
public Rigidbody rb;
private float forwardForce=300f;
public bool partito;
public bool gameOver;
public static Movement current;
void Awake()
{
current = this;
}
private void Start()
{
partito = false;
gameOver = false;
}
void FixedUpdate()
{
if (Input.GetMouseButtonDown(0) && !partito)
{
rb.velocity = new Vector3(0, 0, forwardForce * Time.deltaTime);
partito = true;
}
if (partito && !gameOver)
{
rb.velocity = new Vector3(0, 0, forwardForce * Time.deltaTime);
UIManager.current.GameStart();
}
if ( rb.velocity== Vector3.zero && partito)
{
Spawner.current.gameOver = true;
UIManager.current.GameOver();
}
}
}