private void EnterControlZone(BBRControls machine)
 {
     transform.SetParent(machine.transform, true);
     controls        = machine;
     fpd.enabled     = false;
     headBob.enabled = false;
     machine.game.StartGame();
     lookX.ClearSmoothArrays();
 }
    // Update is called once per frame
    void Update()
    {
        //if (controls == null) {
//			controls = gameControls [0];
//			controls.game.StartGame ();

//		}

        if (isInGame)
        {
            UpdateGame();
            return;
        }

        if (controls != null)
        {
            // get out of range before entering a new control zone
            if (isLeaving || isInGame)
            {
                if (controls.IsOutOfRange(transform.position))
                {
                    controls  = null;
                    isLeaving = false;
                }
                return;
            }

            if (Input.GetKeyDown(KeyCode.E))
            {
                ExitControlZone();
                isLeaving = true;
                return;
            }

            // is the machine tilted
            if (Vector3.Angle(controls.transform.up, Vector3.up) >= 50)
            {
                Debug.Log("game over");
                PlayerController.singleton.EnterGame();
                ShakeCabinet.ashake.CrackScreen();
                return;
            }

            if (Input.GetKeyDown(KeyCode.R))
            {
                controls.game.EndGame();
                controls.game.StartGame();
            }

            int x = (int)Input.GetAxisRaw("Horizontal");
            int y = (int)Input.GetAxisRaw("Vertical");

            Vector3 buttonpos = controls.GetButtonPos(x, y);
            transform.position = new Vector3(buttonpos.x, transform.position.y, buttonpos.z);

            int movex = 0;
            int movey = 0;
            GetInputDown(out movex, out movey);


            controls.game.TakeInput(movex, movey);
        }
        else
        {
            foreach (BBRControls machine in gameControls)
            {
                if (machine.IsInRange(transform.position))
                {
                    if (startTheGame == true)
                    {
                        EnterControlZone(machine);
                    }
                }
            }
        }
    }