您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
41 行
1.0 KiB
41 行
1.0 KiB
using System;
|
|
using Unity.Entities;
|
|
using UnityEngine;
|
|
|
|
#if UNITY_EDITOR
|
|
using UnityEditor;
|
|
#endif
|
|
|
|
namespace Unity.MegaCity.Audio
|
|
{
|
|
/// <summary>
|
|
/// Defines the ECSound emitter type and parameters
|
|
/// such as distance, volume, and probability
|
|
/// </summary>
|
|
|
|
public class SoundEmitterDefinitionAsset : ScriptableObject
|
|
{
|
|
public ECSoundEmitterDefinition data;
|
|
|
|
[NonSerialized]
|
|
private Entity definitionEntity;
|
|
|
|
#if UNITY_EDITOR
|
|
[MenuItem("Assets/Create/Sound Emitter Definition Asset")]
|
|
public static void CreateAsset()
|
|
{
|
|
var asset = CreateInstance<SoundEmitterDefinitionAsset>();
|
|
|
|
asset.data.volume = 0.5f;
|
|
asset.data.maxDist = 100.0f;
|
|
|
|
AssetDatabase.CreateAsset(asset, "Assets/SoundEmitterDefinition.asset");
|
|
AssetDatabase.SaveAssets();
|
|
|
|
EditorUtility.FocusProjectWindow();
|
|
|
|
Selection.activeObject = asset;
|
|
}
|
|
#endif
|
|
}
|
|
}
|