// Use this for initialization void Start() { Cursor.visible = true; Cursor.lockState = CursorLockMode.None; controller = player.GetComponent <PlayerControllerMouse> (); controller.disableMouseControl(); Button play = playButton.GetComponent <Button> (); play.onClick.AddListener(Play); Button quit = quitButton.GetComponent <Button> (); quit.onClick.AddListener(Quit); }
// Use this for initialization void Start() { //Intialize the start position, the forwards direction, backwards direction, and the current direction transform.position = start_position; forwards_direction = Vector3.Normalize(end_position - start_position); backwards_direction = Vector3.Normalize(start_position - end_position); current_direction = forwards_direction; //Face the robot in the forwards_direction transform.rotation = Quaternion.LookRotation(current_direction); //Set the distance to travel before the robot should turn back around distance = Vector3.Distance(start_position, end_position); //Used to disable player control when on gameover screen controller = player.GetComponent <PlayerControllerMouse> (); }