示例#1
0
        public BoardTemplate SetupBoard(SynthData data)
        {
            var board = new BoardTemplate();

            board.AddBoard(data.SubBoards["glideSubBoard"]);

            board.AddBoard(data.SubBoards["pitchWheelSubBoard"]);

            board.AddBoard(data.SubBoards["volumeControlSubBoard"]);


            var env1 = new Envelope(30, 240, 0.6f, 40, 3);

            var o1 = new OscillatorModule(new SawOscillator(), 1);

            var o2 = new OscillatorModule(new SawOscillator(), 1, 0.08f);

            var o3 = new OscillatorModule(new SawOscillator(), 1, 11.92f);

            var d1 = new Distributer(new float[] { 1, 0.7f, 0.0f }, new float[] { 1 });

            //var sf1 = new EffectModule(new SimpleFilter(5));
            var sf1 = new EffectModule(new Filter(Filter.GenerateSincKernel((float)FilterCutoff.Value, 64, data.SampleRate)));

            var g1 = new EffectModule(new Boost(0.2f));

            var lfo2 = new ConstantOscillatorModule(new SineOscillator(), 1, 0.5f);

            var p1 = new Pan();

            var endLeft  = new EndModule(false);
            var endRight = new EndModule(true);

            board.Add(endLeft, endRight, sf1, d1, o3, o2, o1, env1, g1, lfo2, p1);

            //board.AddConnections(glideIn, glideTranslate, glideOut);

            //board.AddConnection(pitchWheel, pitchShift);

            //board.AddConnections(volumeControl, volumeTranslate, boardGain);


            board.AddConnection(env1, o1, destIndex: 0);
            board.AddConnection(env1, o2, destIndex: 0);
            board.AddConnection(env1, o3, destIndex: 0);


            board.AddConnection(o1, d1);
            board.AddConnection(o2, d1);
            board.AddConnection(o3, d1);

            board.AddConnections(d1, g1, sf1, p1);

            board.AddConnection(p1, endLeft);
            board.AddConnection(p1, endRight);

            return(board);
        }
    public void StartEmitter(string type, BaseTile[] tiles)
    {
        if(_effectmodule == null)
        {
            _effectmodule = ModuleManager.getInstance.GetModule<EffectModule>();
        }

        _effects = new EffectController[tiles.Length];

        for(var i = 0; i<tiles.Length; ++i)
        {
            var pos = tiles[i].GetSelfWorldPos();

            _effects[i] = _effectmodule.CreateEffect(type, pos, Quaternion.identity);

            _effects[i].renderer.sortingOrder = tiles[i].GetSortingOrder() + 1;
        }
    }
示例#3
0
    private void AddModule(Type moduleType)
    {
        if (!moduleType.IsSubclassOf(typeof(EffectModule)))
        {
            return;
        }

        EffectModule newModule = (EffectModule)CreateInstance(moduleType);

        if (newModule != null)
        {
            newModule.hideFlags = HideFlags.HideInHierarchy;
            AssetDatabase.AddObjectToAsset(newModule, effect);
            AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(newModule));

            int newIndex = modulesProp.arraySize;
            modulesProp.InsertArrayElementAtIndex(newIndex);
            modulesProp.GetArrayElementAtIndex(newIndex).objectReferenceValue = newModule;
            //Debug.LogFormat("Added module ({0}), new count: {1}", newModule, effectModules.Count);

            serializedObject.ApplyModifiedProperties();
        }
    }
示例#4
0
 private void OnDestroyModule(EffectModule module)
 {
     effectModules.Remove(module);
 }
示例#5
0
    public override void OnInspectorGUI()
    {
        EditorGUI.indentLevel++;
        base.OnInspectorGUI();
        EditorGUI.indentLevel--;

        serializedObject.UpdateIfRequiredOrScript();

        EditorGUI.indentLevel++;
        EditorGUILayout.Separator();
        EditorUtils.Header("Effect Modules");
        EditorGUI.indentLevel--;

        //EditorGUILayout.PropertyField(serializedObject.FindProperty("effectModules"), true);

        modulesProp = serializedObject.FindProperty("effectModules");

        // Make sure the editor array is the same size than the module list
        if (moduleEditors == null || moduleEditors.Length != modulesProp.arraySize)
        {
            Array.Resize(ref moduleEditors, modulesProp.arraySize);
        }

        // Get the module list and draw the editor for each one
        int i = 0;

        while (i < modulesProp.arraySize)
        {
            SerializedProperty moduleProp = modulesProp.GetArrayElementAtIndex(i);
            EffectModule       moduleObj  = (EffectModule)moduleProp.objectReferenceValue;

            // If the module is null, add the index so we remove the module later
            if (moduleObj == null)
            {
                modulesProp.DeleteArrayElementAtIndex(i);
                continue;
            }

            CreateCachedEditor(moduleObj, null, ref moduleEditors[i]);

            EditorGUILayout.Separator();
            moduleProp.isExpanded = EditorGUILayout.InspectorTitlebar(moduleProp.isExpanded, moduleObj, true);
            if (moduleProp.isExpanded)
            {
                EditorGUI.indentLevel++;
                moduleEditors[i].OnInspectorGUI();
                EditorGUI.indentLevel--;
            }

            i++;
        }

        // Draw buttons
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();

        EditorGUI.indentLevel++;

        if (GUILayout.Button(NeepEffect.addModuleText))
        {
            OpenModulesMenu();
        }

        /*
         * if (GUILayout.Button("Clear Modules"))
         * {
         *  effect.ClearModules();
         *  AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(effect));
         * }
         */

        EditorGUI.indentLevel--;

        serializedObject.ApplyModifiedProperties();
    }
 public ListEffectsCommandHandler(EffectModule module)
 {
     this.module = module;
 }