Example #1
0
    public void InitializeOnTeleport(Vector3 spawnPoint)
    {
        _mCircle = FindObjectOfType <MagicCircle> ();
        Debug.Log("Mcircle is " + _mCircle);

        if (VRDevice.isPresent)
        {
            _ActivePlayer = playerRigs [1];
        }
        else
        {
            _ActivePlayer = playerRigs [0];
        }

        _ActivePlayer.transform.SetParent(null);

        if (_mCircle == null)
        {
            _ActivePlayer.SetActive(true);
            _mCircle = _ActivePlayer.GetComponentInChildren <MagicCircle> ();

            Debug.Log("Activated default player");
        }
        else
        {
            Debug.Log("I am reaching else");
            Debug.Log("Coordinates are " + spawnPoint.ToString());
            if (_mCircle.ReturnTeleportStatus() == false)
            {
                StartCoroutine("SceneLoaded", spawnPoint);
                Debug.Log("New scene loaded");
                _mCircle.StopParticles();
            }
        }
    }