public void showSpawnMenu()
 {
     hudControl.setHudVisible(false);
     hudControl.linkHudToAircraft(null);
     pm.switchToType(PerspectiveProperties.CamType.SPECTATOR);
     pm.setMouseLock(false);
     spawnUIPanel.SetActive(true);
 }
    public void setPlayerAsControllable(GameObject playerObj)
    {
        // layer 8 is localPlayer layer
        MoveToLayer(playerObj.transform, 8);

        PlayerInput_Aircraft inputRoot = playerObj.GetComponent <PlayerInput_Aircraft>();

        inputRoot.enabled = true;

        const int localPlayerLayer = 8;

        inputRoot.cannons.setIgnoreLayer(localPlayerLayer);

        CombatFlow playerFlow = playerObj.GetComponent <CombatFlow>();

        playerFlow.team          = team;
        playerFlow.isLocalPlayer = true;

        // Enable flight and engine control
        playerObj.GetComponent <RealFlightControl>().enabled = true;
        playerObj.GetComponent <EngineControl>().enabled     = true;

        // Link hud to obj
        hudControl hud = hudObj.GetComponent <hudControl>();

        hud.setHudVisible(true);
        hud.linkHudToAircraft(playerObj);

        // Enable controllers
        inputRoot.cam.gameObject.SetActive(true);                 // camera
        inputRoot.cannons.gameObject.SetActive(true);             // cannon
        inputRoot.hardpointController.gameObject.SetActive(true); // hardpoints

        // Save this player's camera
        PerspectiveManager.getPManager().mainCam = inputRoot.cam.camRef.GetComponent <Camera>();

        // activate targeting computer and radar
        playerObj.GetComponent <Radar>().enabled       = true;
        playerObj.GetComponent <TgtComputer>().enabled = true;


        inputRoot.isReady = true; // start receiving and processing input
    }