示例#1
0
 // Token: 0x06003FC9 RID: 16329 RVA: 0x001403EC File Offset: 0x0013E7EC
 private void OnEnable()
 {
     if (this.AudioSets.Count <= 0)
     {
         return;
     }
     this.audioSetDic = new Dictionary <int, PhysSoundAudioSet>();
     foreach (PhysSoundAudioSet physSoundAudioSet in this.AudioSets)
     {
         if (this.audioSetDic.ContainsKey(physSoundAudioSet.Key))
         {
             Debug.LogError(string.Concat(new string[]
             {
                 "PhysSound Material ",
                 base.name,
                 " has duplicate audio set for Material Type \"",
                 PhysSoundTypeList.GetKey(physSoundAudioSet.Key),
                 "\". It will not be used during runtime."
             }));
         }
         else
         {
             this.audioSetDic.Add(physSoundAudioSet.Key, physSoundAudioSet);
         }
     }
     if (this.FallbackTypeIndex == 0)
     {
         this.FallbackTypeKey = -1;
     }
     else
     {
         this.FallbackTypeKey = this.AudioSets[this.FallbackTypeIndex - 1].Key;
     }
 }
示例#2
0
 // Token: 0x06003FCF RID: 16335 RVA: 0x00140860 File Offset: 0x0013EC60
 public string[] GetFallbackAudioSets()
 {
     string[] array = new string[this.AudioSets.Count + 1];
     array[0] = "None";
     for (int i = 0; i < this.AudioSets.Count; i++)
     {
         array[i + 1] = PhysSoundTypeList.GetKey(this.AudioSets[i].Key);
     }
     return(array);
 }
示例#3
0
        /// <summary>
        /// Gets the list of audio set names. (Used by the editor to display the list of potential fallback audio sets).
        /// </summary>
        public string[] GetFallbackAudioSets()
        {
            string[] names = new string[AudioSets.Count + 1];
            names[0] = "None";

            for (int i = 0; i < AudioSets.Count; i++)
            {
                names[i + 1] = PhysSoundTypeList.GetKey(AudioSets[i].Key);
            }

            return(names);
        }
示例#4
0
        void OnEnable()
        {
            if (AudioSets.Count <= 0)
            {
                return;
            }

            audioSetDic = new Dictionary <int, PhysSoundAudioSet>();

            foreach (PhysSoundAudioSet audSet in AudioSets)
            {
                if (audioSetDic.ContainsKey(audSet.Key))
                {
                    Debug.LogError("PhysSound Material " + name + " has duplicate audio set for Material Type \"" + PhysSoundTypeList.GetKey(audSet.Key) + "\". It will not be used during runtime.");
                    continue;
                }

                audioSetDic.Add(audSet.Key, audSet);
            }

            if (FallbackTypeIndex == 0)
            {
                FallbackTypeKey = -1;
            }
            else
            {
                FallbackTypeKey = AudioSets[FallbackTypeIndex - 1].Key;
            }
        }
        public override void OnInspectorGUI()
        {
            obj = target as PhysSoundObject;

            mat         = serializedObject.FindProperty("SoundMaterial");
            impactAudio = serializedObject.FindProperty("ImpactAudio");
            autoCreate  = serializedObject.FindProperty("AutoCreateSources");

            serializedObject.Update();

            EditorGUILayout.Separator();

            EditorGUILayout.LabelField("PhysSound Material:", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(mat, true);

            if (obj.SoundMaterial == null)
            {
                EditorGUILayout.HelpBox("No PhysSound Material is assigned!", MessageType.Warning);
                serializedObject.ApplyModifiedProperties();
                return;
            }

            if (obj.SoundMaterial.AudioSets.Count > 0)
            {
                //EditorGUILayout.Separator();
                GUILayout.Box("", GUILayout.MaxWidth(Screen.width - 25f), GUILayout.Height(dividerHeight));

                EditorGUILayout.LabelField("Audio Sources:", EditorStyles.boldLabel);

                EditorGUILayout.PropertyField(autoCreate);

                if (obj.AutoCreateSources)
                {
                    EditorGUILayout.PropertyField(impactAudio, new GUIContent("Template Audio"), true);
                }
                else
                {
                    EditorGUILayout.PropertyField(impactAudio, true);
                    EditorGUILayout.Separator();

                    //Update the audio container list with new objects
                    foreach (PhysSoundAudioSet audSet in obj.SoundMaterial.AudioSets)
                    {
                        if (!obj.HasAudioContainer(audSet.Key))
                        {
                            obj.AddAudioContainer(audSet.Key);
                        }
                    }

                    //Remove any audio containers that don't match with the material.
                    for (int i = 0; i < obj.AudioContainers.Count; i++)
                    {
                        PhysSoundAudioContainer audCont = obj.AudioContainers[i];

                        if (!obj.SoundMaterial.HasAudioSet(audCont.KeyIndex))
                        {
                            obj.RemoveAudioContainer(audCont.KeyIndex);
                            i--;
                        }

                        audCont.SlideAudio = EditorGUILayout.ObjectField(PhysSoundTypeList.GetKey(audCont.KeyIndex) + " Slide Audio", audCont.SlideAudio, typeof(AudioSource), true) as AudioSource;
                    }
                }
            }

            EditorGUILayout.Separator();

            EditorUtility.SetDirty(obj);

            serializedObject.ApplyModifiedProperties();
        }