示例#1
0
        public static int?PlaySound(this SoundComponent soundComponent, int soundId, EntityViewLogic 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 = new PlaySoundParams
            {
                Priority           = drSound.Priority,
                Loop               = drSound.Loop,
                VolumeInSoundGroup = drSound.Volume,
                SpatialBlend       = drSound.SpatialBlend,
            };

            return(soundComponent.PlaySound(AssetUtility.GetSoundAsset(drSound.AssetName), "Sound", Constant.AssetPriority.SoundAsset, playSoundParams, bindingEntity != null ? bindingEntity.Entity : null, userData));
        }
示例#2
0
 public static void HideEntity(this EntityComponent entityComponent, EntityViewLogic entity)
 {
     entityComponent.HideEntity(entity.Entity);
 }
示例#3
0
 public static void AttachEntity(this EntityComponent entityComponent, EntityViewLogic entity, int ownerId, string parentTransformPath = null, object userData = null)
 {
     entityComponent.AttachEntity(entity.Entity, ownerId, parentTransformPath, userData);
 }
示例#4
0
 protected virtual void OnDead(EntityViewLogic attacker)
 {
     GameEntry.Entity.HideEntity(this);
 }