public int Play(EPlayerSoundType sound) { if (Logger.IsDebugEnabled) { Logger.DebugFormat("play {0}", sound); } if (null == _playerEntity) { return(UniversalConsts.InvalidIntId); } var soundConfigItem = _soundConvert.Convert(_playerEntity, sound); 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); }
public int GetSoundIdByType(EPlayerSoundType soundType) { if (!_soundTypeDic.ContainsKey(soundType)) { return(UniversalConsts.InvalidIntId); } if (_soundTypeDic.Count == 1) { return(_soundTypeDic[soundType][0]); } var list = _soundTypeDic[soundType]; return(list[Random.Range(0, list.Count)]); }
public int PlayOnce(EPlayerSoundType sound) { if (Logger.IsDebugEnabled) { Logger.DebugFormat("PlayOnce {0}", sound); } if (null == _playerEntity) { return(UniversalConsts.InvalidIntId); } var soundCfg = _soundConvert.Convert(_playerEntity, sound); return(PlayOnce(soundCfg)); }
public SoundConfigItem Convert(PlayerEntity playerEntity, EPlayerSoundType playerSoundType) { switch ((EPlayerSoundType)playerSoundType) { case EPlayerSoundType.Walk: return(ConvertTerrainSound(playerEntity, ETerrainSoundType.Walk)); case EPlayerSoundType.Squat: return(ConvertTerrainSound(playerEntity, ETerrainSoundType.Squat)); case EPlayerSoundType.Crawl: return(ConvertTerrainSound(playerEntity, ETerrainSoundType.Crawl)); case EPlayerSoundType.Land: return(ConvertTerrainSound(playerEntity, ETerrainSoundType.Land)); default: return(ConvertPlayerSound(playerEntity, playerSoundType)); } }
public int PlayOnce(EPlayerSoundType soundType) { return(-1); }
public int Play(EPlayerSoundType type) { return(-1); }
private SoundConfigItem ConvertPlayerSound(PlayerEntity playerEntity, EPlayerSoundType soundType) { var id = _playerSoundConfigManager.GetSoundIdByType(soundType); return(_soundConfigManager.GetSoundById(id)); }