示例#1
0
    private void CreateEventPrefab(int levelSize)
    {
        GameObject go = new GameObject();

        Manager.EventTree = AudioEventWorker.CreateTree(go, levelSize);
        SaveAndLoad.CreateAudioEventRootPrefab(go);
    }
示例#2
0
    private void DrawStartFromScratch()
    {
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();

        if (GUILayout.Button("Start over from scratch", GUILayout.Height(30)))
        {
            if (EditorUtility.DisplayDialog("Create new project?", "This will delete ALL data!", "Start from scratch", "Do nothing"))
            {
                FolderSettings.DeleteFolderContent(Application.dataPath + FolderSettings.BankDeleteFolder);

                int        levelSize = 3;
                GameObject go1       = new GameObject();
                GameObject go2       = new GameObject();
                GameObject go3       = new GameObject();
                GameObject go4       = new GameObject();

                Manager.BusTree      = AudioBusWorker.CreateTree(go3);
                Manager.BankLinkTree = AudioBankWorker.CreateTree(go4);
                Manager.AudioTree    = AudioNodeWorker.CreateTree(go1, levelSize, Manager.BusTree);
                Manager.EventTree    = AudioEventWorker.CreateTree(go2, levelSize);

                SaveAndLoad.CreateDataPrefabs(Manager.AudioTree.gameObject, Manager.EventTree.gameObject, Manager.BusTree.gameObject, Manager.BankLinkTree.gameObject);

                Manager.Load(true);

                if (Manager.BankLinkTree != null)
                {
                    var bankLink = AudioBankWorker.CreateBank(Manager.BankLinkTree.gameObject, Manager.BankLinkTree,
                                                              GUIDCreator.Create());
                    bankLink.Name     = "Default - Auto loaded";
                    bankLink.AutoLoad = true;
                    var bankLink2 = AudioBankWorker.CreateBank(Manager.BankLinkTree.gameObject, Manager.BankLinkTree,
                                                               GUIDCreator.Create());
                    bankLink2.Name = "Extra";

                    NodeWorker.AssignToNodes(Manager.AudioTree, node => node.BankLink = Manager.BankLinkTree.GetChildren[0]);
                }
                else
                {
                    Debug.LogError("There was a problem creating the data.");
                }

                NodeWorker.AssignToNodes(Manager.AudioTree, node => node.Bus = Manager.BusTree);

                AssetDatabase.Refresh();

                EditorApplication.SaveCurrentSceneIfUserWantsTo();
            }
        }
    }