Exemplo n.º 1
0
    /// <summary>
    /// Creates the suitable mesh for the segment and a set of child game objects for the deeper
    /// parts of the tree.
    /// </summary>
    public void Build()
    {
        removeAllSuperStructureSlots();
        base.Build();

        renderer.material.color = _anchorPositions == 0 ? interactableColor : segmentColor;
        Vector3 wp = transform.position;

        if (_anchorPositions == 0)
        {
            wp.z = 0f;
        }
        else
        {
            wp.z = .1f;
        }
        transform.position = wp;

        if (_anchorPositions > 0)
        {
            while (superStructureSlotsFree > 0)
            {
                //Debug.Log(superStructureSlotsFree);
                GameObject go = new GameObject();
                Plant      p  = go.AddComponent <Plant>();
                go.transform.parent = transform;
                p.foundation        = this;
                updateChild(p);
                p.Start();
                go.name = p.getName();
                p.Build();
            }
        }
    }