示例#1
0
    void Start()
    {
        // calculate positions for the LineRenderer (cannot assume Editor script has been invoked to do this)
        GameObject parent = transform.parent.gameObject;

        if (parent != null)
        {
            EllipseBase ellipseBase = parent.GetComponent <EllipseBase>();
            if (ellipseBase != null)
            {
                orbitP = ellipseBase;
            }
            else
            {
                OrbitHyper orbitHyper = parent.GetComponent <OrbitHyper>();
                if (orbitHyper != null)
                {
                    orbitP = orbitHyper;
                }
                else
                {
                    Debug.LogWarning("Parent object must have OrbitEllipse or OrbitHyper - cannot compute positions for line");
                }
            }
        }
        else
        {
            Debug.LogWarning("No parent object - cannot compute positions for line");
        }
        lineR = GetComponent <LineRenderer>();
        lineR.positionCount = numPoints;
    }