static int PlaySound(IntPtr L) { try { ToLua.CheckArgsCount(L, 4); UnityGameFramework.Runtime.SoundComponent arg0 = (UnityGameFramework.Runtime.SoundComponent)ToLua.CheckUnityObject(L, 1, typeof(UnityGameFramework.Runtime.SoundComponent)); int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); StarForce.Entity arg2 = (StarForce.Entity)ToLua.CheckUnityObject(L, 3, typeof(StarForce.Entity)); object arg3 = ToLua.ToVarObject(L, 4); System.Nullable <int> o = StarForce.SoundExtension.PlaySound(arg0, arg1, arg2, arg3); ToLua.PushObject(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// 场景物体音效 /// </summary> /// <param name="soundComponent"></param> /// <param name="soundId"></param> /// <param name="bindingEntity"></param> /// <param name="userData"></param> /// <returns></returns> public static int?PlaySound(this SoundComponent soundComponent, int soundId, StarForce.Entity bindingEntity = null, object userData = null) { IDataTable <DRSound> dtSound = GameEntry.DataTable.GetDataTable <DRSound>(); DRSound drSound = dtSound.GetDataRow(soundId); if (drSound == null) { Log.Warning("Can not load sound '{0}' from data table.", soundId.ToString()); return(null); } PlaySoundParams playSoundParams = PlaySoundParams.Create(); playSoundParams.Priority = drSound.Priority; playSoundParams.Loop = drSound.Loop; playSoundParams.VolumeInSoundGroup = drSound.Volume; playSoundParams.SpatialBlend = drSound.SpatialBlend; return(soundComponent.PlaySound(AssetUtility.GetSoundAsset(drSound.AssetName), "Sound", Constant.AssetPriority.SoundAsset, playSoundParams, bindingEntity != null ? bindingEntity.Entity : null, userData)); }
public static void HideEntity(this EntityComponent entityComponent, Entity entity) { entityComponent.HideEntity(entity.Entity); }