Example #1
0
    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
        ExampleARSessionManager easm = FindObjectOfType <ExampleARSessionManager>();

        easm.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();

        _arLocationSync          = GetComponent <ARLocationSync> ();
        _exampleARSessionManager = FindObjectOfType <ExampleARSessionManager>();


        // Send custom player info
        // This is an example of sending additional information to the server that might be needed in the lobby (eg. colour, player image, personal settings, etc.)

        myColour = UnityEngine.Random.ColorHSV(0, 1, 1, 1, 1, 1);
        CmdSetCustomPlayerInfo(myColour);
        locationSent = false;
    }
    public override void OnStartLocalPlayer()
    {
        base.OnStartLocalPlayer();
        CmdMakeCnt(transform.position, transform.rotation);

        _arLocationSync          = GetComponent <ARLocationSync>();
        _exampleARSessionManager = FindObjectOfType <ExampleARSessionManager>();


        // カスタムプレーヤーの情報を送信する
        // 必要な情報を追加 (例 色, プレイたーの画像, 個人設定, etc...)

        myColour = UnityEngine.Random.ColorHSV(0, 1, 1, 1, 1, 1);
        CmdSetCustomPlayerInfo(myColour);
        locationSent = false;
    }
Example #4
0
    public IEnumerator Relocate(byte[] receivedBytes)
    {
        //start relocation
        ARWorldMap arWorldMap = ARWorldMap.SerializeFromByteArray(receivedBytes);

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

        easm.StartSession(arWorldMap);

        //check tracking state and update UI
        while (_arTrackingState != ARTrackingState.ARTrackingStateLimited || _arTrackingStateReason != ARTrackingStateReason.ARTrackingStateReasonRelocalizing)
        {
            yield return(null);             //wait until it starts relocalizing
        }

        while (_arTrackingState != ARTrackingState.ARTrackingStateNormal)
        {
            yield return(null);
        }
    }
Example #5
0
 public override void OnStartServer()
 {
     networkListener   = FindObjectOfType <ExampleListener>();
     _arSessionManager = FindObjectOfType <ExampleARSessionManager> ();
     gameState         = GameState.Connecting;
 }