public int Play(int soundId) { if (Logger.IsDebugEnabled) { Logger.DebugFormat("play {0}", soundId); } if (null == _playerEntity) { return(UniversalConsts.InvalidIntId); } var soundConfigItem = _soundConfigManager.GetSoundById(soundId); if (null == soundConfigItem) { return(UniversalConsts.InvalidIntId); } var entity = soundConfigItem.Sync ? _soundEntityFactory.CreateSyncSound(_playerEntity, soundConfigItem, true) : _soundEntityFactory.CreateSelfOnlySound(soundConfigItem.Id, _playerEntity.position.Value, true); var soundEntity = entity as SoundEntity; if (null == soundEntity) { return(UniversalConsts.InvalidIntId); } return(soundEntity.entityKey.Value.EntityId); }
private SoundEntity CreateSoundEntity(int soundId) { var isLoopSound = _soundConfigManager.IsLoopSound(soundId); var soundEntity = (SoundEntity)_soundEntityFactory.CreateSelfOnlySound(soundId, isLoopSound); if (soundEntity != null) { soundEntity.isFlagPreventDestroy = true; } else { _logger.ErrorFormat("Configuration Error: The Sound Id {0} for Vehicle does not exist!", soundId); } return(soundEntity); }