Exemplo n.º 1
0
 private void EnsureSetup()
 {
     if (parabolicLineData == null)
     {
         parabolicLineData = GetComponent <ParabolaPhysicalLineDataProvider>();
     }
 }
        private void EnsureSetup()
        {
            if (parabolicLineData == null)
            {
                parabolicLineData = gameObject.GetComponent <ParabolaPhysicalLineDataProvider>();
            }

            if (parabolicLineData.LineTransform == transform)
            {
                Debug.LogWarning("Missing Parabolic line helper.\nThe Parabolic Teleport Pointer requires an empty GameObject child for calculating the parabola arc. Creating one now.");

                var pointerHelper = transform.Find("ParabolicLinePointerHelper");

                if (pointerHelper == null)
                {
                    pointerHelper = new GameObject("ParabolicLinePointerHelper").transform;
                    pointerHelper.transform.SetParent(transform);
                }

                pointerHelper.transform.localPosition = Vector3.zero;
                parabolicLineData.LineTransform       = pointerHelper.transform;
            }
        }