public IEnumerator Relocate(byte[] receivedBytes)
    {
        //Start relocation
        statusGO.SetActive(true);
        statusText.text = "Start relocalize..";
        ARWorldMap arWorldMap = ARWorldMap.SerializeFromByteArray(receivedBytes);

        //Use the AR Session manager to restart session with received world map to sync up
        BP_ARSessionManager beerPongARSessionManager = FindObjectOfType <BP_ARSessionManager>();

        beerPongARSessionManager.StartSession(arWorldMap);

        //Check tracking state and update UI
        while (_arTrackingState != ARTrackingState.ARTrackingStateLimited || _arTrackingStateReason != ARTrackingStateReason.ARTrackingStateReasonRelocalizing)
        {
            yield return(null); //wait until it starts relocalizing
        }
        statusText.text = "Relocalizing... look around the area";

        while (_arTrackingState != ARTrackingState.ARTrackingStateNormal)
        {
            yield return(null);
        }

        statusText.text = "Relocalized!";
        yield return(null);

        statusGO.SetActive(false);
        yield return(null);
    }
Example #2
0
    public override void OnStartLocalPlayer()
    {
        base.OnStartLocalPlayer();

        _beerPongLocationSync     = GetComponent <BeerPongARLocationSync>();
        _beerPongARSessionManager = FindObjectOfType <BP_ARSessionManager>();

        //Send Custome player info
        // This is an example of sending additional information to the server that might be needed in the lobby (eg. color, player avatar, personal settings, etc.)
        myColor = UnityEngine.Random.ColorHSV(0, 1, 1, 1, 1, 1);
        CmdSetCustomePlayerInfo(myColor);
        locationSent = false;
    }
Example #3
0
 public override void OnStartServer()
 {
     networkListener   = FindObjectOfType <BP_Listener>();
     _arSessionManager = FindObjectOfType <BP_ARSessionManager>();
     gameState         = BP_GameState.Connecting;
 }