Exemple #1
0
    void OnGUI()
    {
        bool canCreate = false;

        EditorGUIUtility.fieldWidth = 70f;
        EditorGUIUtility.labelWidth = 80f;

        _sampleBank = ( GATActiveSampleBank )EditorGUILayout.ObjectField("Sample Bank:", _sampleBank, typeof(GATSampleBank), true);

        if (_sampleBank != null)
        {
            if (_sampleBank.SoundBank == null)
            {
                EditorGUILayout.HelpBox("Your SampleBank must refer to a SoundBank!", MessageType.Error);
            }
            else
            {
                canCreate = true;
            }
        }
        else
        {
            EditorGUILayout.HelpBox("Creating a Music System is a shortcut to create and link a MasterPulse, an Envelope, and a Pattern. Creating a Music System requires a SampleBank object in your scene.", MessageType.Info);
        }

        GUI.enabled = canCreate;

        GUI.color = Color.green;

        if (GUILayout.Button("Create", GUILayout.ExpandWidth(false)))
        {
            MasterPulseModule pulse = GATEditorUtilities.NewChildGO <MasterPulseModule>("Music System");

            EnvelopeModule envelope = GATEditorUtilities.NewChildGO <EnvelopeModule>("Envelope", pulse.gameObject);
            envelope.Pulse      = pulse;
            envelope.MaxSamples = _sampleBank.SoundBank.SizeOfShortestSample();

            PulsedPatternModule pattern = GATEditorUtilities.NewChildGO <PulsedPatternModule>("Pattern", pulse.gameObject);
            pattern.Envelope   = envelope;
            pattern.SampleBank = _sampleBank;
            pattern.Pulse      = pulse;

            pattern.AddSample(_sampleBank.SoundBank.SampleInfos[0].Name);

            this.Close();
        }
    }
    void OnGUI()
    {
        EditorGUIUtility.fieldWidth = 150f;
        EditorGUIUtility.labelWidth = 80f;
        _soundBank = ( GATSoundBank )EditorGUILayout.ObjectField("Sound Bank: ", _soundBank, typeof(GATSoundBank), false, GUILayout.ExpandWidth(false));

        if (_soundBank == false)
        {
            EditorGUILayout.HelpBox(__soundBankHelp, MessageType.Info);
            GUI.enabled = false;
        }
        else
        {
            _bankType = ( BankType )EditorGUILayout.EnumPopup("Bank Type: ", _bankType, GUILayout.ExpandWidth(false));
            EditorGUILayout.HelpBox(__bankTypesHelp[( int )_bankType], MessageType.Info);
        }

        GUI.color = Color.green;
        if (GUILayout.Button("Create", GUILayout.Width(70f)))
        {
            GATEditorUtilities.CheckManager();

            GATSampleBank bank = null;

            switch (_bankType)
            {
            case BankType.Simple:
                bank = GATEditorUtilities.NewChildGO <GATSampleBank>("Sample Bank");
                break;

            case BankType.Active:
                bank = GATEditorUtilities.NewChildGO <GATActiveSampleBank>("Sample Bank");
                break;
            }

            bank.EditorUpdateSoundBank(_soundBank);

            this.Close();
        }
    }
Exemple #3
0
    static void CreatePulsedSamples()
    {
        GATEditorUtilities.CheckManager();

        GATEditorUtilities.NewChildGO <PulsedPatternModule>("Pulsed Pattern");
    }
Exemple #4
0
    static void CreateSubPulse()
    {
        GATEditorUtilities.CheckManager();

        GATEditorUtilities.NewChildGO <SubPulseModule>("Sub Pulse");
    }
Exemple #5
0
    static void CreateMasterPulse()
    {
        GATEditorUtilities.CheckManager();

        GATEditorUtilities.NewChildGO <MasterPulseModule>("Master Pulse");
    }
Exemple #6
0
    static void CreateEnvelope()
    {
        GATEditorUtilities.CheckManager();

        GATEditorUtilities.NewChildGO <EnvelopeModule>("Envelope");
    }