Beispiel #1
0
    public override GameObject Build()
    {
        PackageNode node = (PackageNode)Node;

        Vector2           size         = Vector2.zero;
        List <CityLayout> childLayouts = new List <CityLayout>();

        GameObj = MonoBehaviour.Instantiate(prefabs[ObjectType.Package], Vector3.zero, Quaternion.identity);
        GameObj.GetComponent <Details>().Node = Node;

        // Build All Child Packages
        foreach (PackageNode childPkg in node.Packages)
        {
            PackageObject po      = new PackageObject(childPkg, prefabs);
            GameObject    childGo = po.Build();
            childLayouts.Add(po);

            size += new Vector2(po.LayoutSize.x, po.LayoutSize.z);
        }

        // Build All Child Classes
        foreach (ClassNode childCls in node.Classes)
        {
            ClassObject co      = new ClassObject(childCls, prefabs);
            GameObject  childGo = co.Build();
            childLayouts.Add(co);

            size += new Vector2(co.LayoutSize.x, co.LayoutSize.z);
        }

        LayoutChildren(GameObj, childLayouts, size);

        return(GameObj);
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        ProjectXMLReader reader  = new ProjectXMLReader();
        ProjectNode      project = reader.LoadProject(projectXmlFile);
        PackageNode      main    = project.Packages[0];

        Dictionary <ObjectType, GameObject> prefabs = new Dictionary <ObjectType, GameObject>()
        {
            { ObjectType.Package, packagePrefab },
            { ObjectType.Class, classPrefab },
            { ObjectType.Interface, interfacePrefab },
            { ObjectType.Method, methodPrefab },
        };
        PackageObject authObject = new PackageObject(main, prefabs);

        GameObject city = authObject.Build();

        city.transform.localScale = city.transform.localScale * .5f;
    }