Ejemplo n.º 1
0
    public void CopyModelTo(LowPolyModel other)
    {
        Component[] theseComponents = this.GetComponentsInChildren <Component>(true);
        Component[] otherComponents = other.GetComponentsInChildren <Component>(true);

        int numLRs = theseComponents.Length;

        if (otherComponents.Length == numLRs)
        {
            for (int i = 0; i < numLRs; i++)
            {
                LowPolyModelValues.CopyFromTo(theseComponents[i], otherComponents[i]);
            }
        }
        else
        {
            Debug.Log("Numcomponents error");
        }

        other.changeCount = changeCount;
    }
Ejemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        LowPolyModel lpm = target as LowPolyModel;

        EditorGUILayout.LabelField("ChangeCount: " + lpm.changeCount);

        if (lpm.referenceModel != null)
        {
            if (GUILayout.Button("Apply changes to reference"))
            {
                lpm.CopyModelTo(lpm.referenceModel);
            }
        }
        else
        {
            if (GUILayout.Button("Send changes"))
            {
                lpm.changeCount++;
            }
        }
    }
Ejemplo n.º 3
0
    public bool ValuesEquals(LowPolyModel other)
    {
        Component[] thisComponents  = this.GetComponentsInChildren <Component>(true);
        Component[] otherComponents = other.GetComponentsInChildren <Component>(true);

        int numComponents = thisComponents.Length;

        if (otherComponents.Length != numComponents)
        {
            return(false);
        }
        else
        {
            for (int i = 0; i < numComponents; i++)
            {
                if (LowPolyModelValues.Equality(thisComponents[i], otherComponents[i]) == false)
                {
                    return(false);
                }
            }
        }

        return(true);
    }